diff --git a/modules/mol/mm/src/modeller.cc b/modules/mol/mm/src/modeller.cc
index 808d8634578f6a27305e9c702e42dbb9c68ac6bc..1a9da309452b9c0926fd3e1d27dff00dc6120f89 100644
--- a/modules/mol/mm/src/modeller.cc
+++ b/modules/mol/mm/src/modeller.cc
@@ -36,7 +36,7 @@ bool BoundToSG(const ost::mol::AtomHandle& atom){
   ost::mol::AtomHandleList bound_atoms = atom.GetBondPartners();
   for(ost::mol::AtomHandleList::iterator i = bound_atoms.begin();
       i != bound_atoms.end(); ++i){
-    if(i->GetResidue() != atom.GetResidue()) continue;
+    if(i->GetResidue() == atom.GetResidue()) continue;
     if(i->GetName() != "SG") continue;
     if(IsCysteine(i->GetResidue())) return true;
   }