Index: branches/czw_branch/20160809/psastro/src/psastroMosaicAstrom.c
===================================================================
--- branches/czw_branch/20160809/psastro/src/psastroMosaicAstrom.c	(revision 39782)
+++ branches/czw_branch/20160809/psastro/src/psastroMosaicAstrom.c	(revision 39784)
@@ -56,22 +56,25 @@
     }
 
-    // now fit the chips under the common distortion with higher-order terms
-    // first, re-perform the match with a slightly tighter circle
-    if (!psastroMosaicSetMatch (fpa, recipe, nIter)) {
-        psError(PSASTRO_ERR_UNKNOWN, false, "failed to match raw and ref stars for mosaic (4th pass)");
-        return false;
-    }
-    if (!psastroMosaicChipAstrom (fpa, recipe, nIter)) {
-        psError(PSASTRO_ERR_UNKNOWN, false, "failed to measure chip astrometry in mosaic mode (4th pass)");
-        return false;
-    }
-
-    if (psTraceGetLevel("psastro.dump") > 0) {
+    
+    for (int iter = 0; (iter < nIter); iter++) {
+      // now fit the chips under the common distortion with higher-order terms
+      // first, re-perform the match with a slightly tighter circle
+      if (!psastroMosaicSetMatch (fpa, recipe, iter)) {
+        psError(PSASTRO_ERR_UNKNOWN, false, "failed to match raw and ref stars for mosaic (4th pass %d)", iter);
+        return false;
+      }
+      if (!psastroMosaicChipAstrom (fpa, recipe, iter)) {
+        psError(PSASTRO_ERR_UNKNOWN, false, "failed to measure chip astrometry in mosaic mode (pass %d)", iter);
+        return false;
+      }
+      
+      if (psTraceGetLevel("psastro.dump") > 0) {
         // the last filename (see filenames in psastroMosaicFit)
         char filename[256];
         snprintf (filename, 256, "%s.%d.dat", outroot, 2*nIter + 2);
         psastroDumpMatches (fpa, filename);
-    }
-
+      }
+    }
+    
     // save WCS and analysis metadata in update header.
     // (pull or create local view to entry on readout->analysis)
