Index: trunk/BNC/combination/bnccomb.cpp
===================================================================
--- trunk/BNC/combination/bnccomb.cpp	(revision 3440)
+++ trunk/BNC/combination/bnccomb.cpp	(revision 3441)
@@ -399,19 +399,21 @@
   }
 
-  Matrix         AA;
-  ColumnVector   ll;
-  DiagonalMatrix PP;
+  SymmetricMatrix QQ_sav = _QQ;
+
+  ColumnVector dx;
   QMap<QString, t_corr*> resCorr;
-
-  if (createAmat(AA, ll, PP, x0, resCorr) != success) {
-    return;
-  }
-
-  ColumnVector dx;
-  SymmetricMatrix QQ_sav = _QQ;
-
+    
   // Update and outlier detection loop
   // ---------------------------------
-  for (int ii = 1; ii < 10; ii++) {
+  while (true) {
+
+    Matrix         AA;
+    ColumnVector   ll;
+    DiagonalMatrix PP;
+
+    if (createAmat(AA, ll, PP, x0, resCorr) != success) {
+      return;
+    }
+
     bncModel::kalman(AA, ll, PP, _QQ, dx);
     ColumnVector vv = ll - AA * dx;
@@ -439,6 +441,5 @@
       out << "  Outlier" << endl;
       _QQ = QQ_sav;
-      AA.Row(maxResIndex) = 0.0;
-      ll.Row(maxResIndex) = 0.0;
+      corrs().remove(maxResIndex-1);
     }
     else {
