diff --git a/modules/qa/src/all_atom_potential.cc b/modules/qa/src/all_atom_potential.cc
index 8ec0123c3a407eaebdff634fea19170d93ae75ad..b59337914c6148d89945a4351930fff5cb1efadf 100644
--- a/modules/qa/src/all_atom_potential.cc
+++ b/modules/qa/src/all_atom_potential.cc
@@ -81,7 +81,7 @@ public:
           if (d<0) d=0.0;
 
           if (d>options_.lower_cutoff) {
-            if (abs(atom_handle.GetResidue().GetNumber().GetNum()-a.GetResidue().GetNumber().GetNum())<options_.sequence_sep) {
+            if (abs(atom_handle.GetResidue().GetIndex()-a.GetResidue().GetIndex())<options_.sequence_sep) {
               continue;
             }
             energy_+=energies_.Get(type_a, type_b, d);
@@ -89,6 +89,9 @@ public:
             //std::cout << type_a << "(" << atom_handle.GetQualifiedName() << ")" << " " << type_b << "(" << a.GetQualifiedName() << ")" << " : " << d << "     " << energies_.Get(type_a, type_b, d) << std::endl;
           }
         }
+// 	else {
+// 	  std::cout << "Unknown type: " << type_b << std::endl;
+// 	}
       }
     }
     return false;
diff --git a/modules/qa/src/multi_classifier.hh b/modules/qa/src/multi_classifier.hh
index 28107bd91ace9ab2e8584af3c61dc491f6944fb5..371b4f4d35058d8306d911680fe02df23e7dc71e 100644
--- a/modules/qa/src/multi_classifier.hh
+++ b/modules/qa/src/multi_classifier.hh
@@ -176,6 +176,7 @@ public:
   uint32_t GetIndexOf(Real value) const {
     Real factor=(value-lower_bound_)/(upper_bound_-lower_bound_);
     uint32_t idx=uint32_t(floor(this->GetNumberOfClasses()*factor));
+//     std::cout << value << " " << factor << std::endl;
     assert(this->GetNumberOfClasses()>idx);
     return idx;
   }
diff --git a/modules/qa/src/torsion_potential.cc b/modules/qa/src/torsion_potential.cc
index d40ae0e039cccac66fda49f7c01a31890df9b59f..828c6365b2e811f81bcfde3d6c7226977159dc9e 100644
--- a/modules/qa/src/torsion_potential.cc
+++ b/modules/qa/src/torsion_potential.cc
@@ -68,12 +68,12 @@ public:
     if (!prev_phit || !prev_psit || !central_phit || !central_psit ||
         !next_phit || !next_psit)
       return false;
-    Real prev_phi=prev_phit.GetAngle()*180/M_PI - 0.000000001;
-    Real prev_psi=prev_psit.GetAngle()*180/M_PI - 0.000000001;
-    Real central_phi=central_phit.GetAngle()*180/M_PI - 0.000000001;
-    Real central_psi=central_psit.GetAngle()*180/M_PI - 0.000000001;
-    Real next_phi=next_phit.GetAngle()*180/M_PI - 0.000000001;
-    Real next_psi=next_psit.GetAngle()*180/M_PI - 0.000000001;
+    Real prev_phi=prev_phit.GetAngle()*180/M_PI - 0.001; if (prev_phi<-180) prev_phi=-180;
+    Real prev_psi=prev_psit.GetAngle()*180/M_PI - 0.001; if (prev_psi<-180) prev_psi=-180;
+    Real central_phi=central_phit.GetAngle()*180/M_PI - 0.001; if (central_phi<-180) central_phi=-180;
+    Real central_psi=central_psit.GetAngle()*180/M_PI - 0.001; if (central_psi<-180) central_psi=-180;
+    Real next_phi=next_phit.GetAngle()*180/M_PI - 0.001; if (next_phi<-180) next_phi=-180;
+    Real next_psi=next_psit.GetAngle()*180/M_PI - 0.001; if (next_psi<-180) next_psi=-180;
 
     // calculate position of the amino acid in the alphabet
     int icenter=this->GetAAIndex(ca);
diff --git a/modules/qa/src/torsion_statistics.cc b/modules/qa/src/torsion_statistics.cc
index e1b427e017c729d2b35ea79958b5d542899b9f29..d1cb110262974a919cbd060cd42f3c71ba1f7683 100644
--- a/modules/qa/src/torsion_statistics.cc
+++ b/modules/qa/src/torsion_statistics.cc
@@ -62,12 +62,12 @@ public:
     if (!prev_phit || !prev_psit || !central_phit || !central_psit ||
         !next_phit || !next_psit)
       return false;
-    Real prev_phi=prev_phit.GetAngle()*180/M_PI - 0.000000001;
-    Real prev_psi=prev_psit.GetAngle()*180/M_PI - 0.000000001;
-    Real central_phi=central_phit.GetAngle()*180/M_PI - 0.000000001;
-    Real central_psi=central_psit.GetAngle()*180/M_PI - 0.000000001;
-    Real next_phi=next_phit.GetAngle()*180/M_PI - 0.000000001;
-    Real next_psi=next_psit.GetAngle()*180/M_PI - 0.000000001;
+    Real prev_phi=prev_phit.GetAngle()*180/M_PI - 0.001;
+    Real prev_psi=prev_psit.GetAngle()*180/M_PI - 0.001;
+    Real central_phi=central_phit.GetAngle()*180/M_PI - 0.001;
+    Real central_psi=central_psit.GetAngle()*180/M_PI - 0.001;
+    Real next_phi=next_phit.GetAngle()*180/M_PI - 0.001;
+    Real next_psi=next_psit.GetAngle()*180/M_PI - 0.001;
 
     histo_.Add(1, ca, prev_phi, prev_psi, central_phi, central_psi, next_phi, next_psi);
     return false;