Index: trunk/psphot/src/psphotReadout.c
===================================================================
--- trunk/psphot/src/psphotReadout.c	(revision 9270)
+++ trunk/psphot/src/psphotReadout.c	(revision 9519)
@@ -40,5 +40,5 @@
 
     if (!strcasecmp (breakPt, "PEAKS")) {
-	psphotReadoutCleanup (config, readout, recipe, NULL, sources);
+	if (!psphotReadoutCleanup (config, readout, recipe, NULL, sources)) return false;
 	return true;
     }
@@ -57,5 +57,5 @@
     }
     if (!strcasecmp (breakPt, "MOMENTS")) {
-	psphotReadoutCleanup (config, readout, recipe, NULL, sources);
+	if (!psphotReadoutCleanup (config, readout, recipe, NULL, sources)) return false;
 	return true;
     }
@@ -64,5 +64,5 @@
     pmPSF *psf = psphotChoosePSF (readout, sources, recipe);
     if (!strcasecmp (breakPt, "PSFMODEL")) {
-	psphotReadoutCleanup (config, readout, recipe, psf, sources);
+	if (!psphotReadoutCleanup (config, readout, recipe, psf, sources)) return false;
 	return true;
     }
@@ -71,5 +71,5 @@
     psphotEnsemblePSF (readout, sources, recipe, psf, FALSE);
     if (!strcasecmp (breakPt, "ENSEMBLE")) {
-	psphotReadoutCleanup (config, readout, recipe, psf, sources);
+	if (!psphotReadoutCleanup (config, readout, recipe, psf, sources)) return false;
 	return true;
     }
@@ -94,5 +94,4 @@
 	psTrace ("psphotReadout", 4, "failure on psphotApResid"); 
         psError(PSPHOT_ERR_PHOTOM, false, "Measure aperture photometry corrections");
-	psphotReadoutCleanup (config, readout, recipe, psf, sources);
         return false;
     }
@@ -109,5 +108,5 @@
 
     // create the exported-metadata and free local data
-    psphotReadoutCleanup (config, readout, recipe, psf, sources);
+    if (!psphotReadoutCleanup (config, readout, recipe, psf, sources)) return false;
     return true;
 }
@@ -117,7 +116,13 @@
     // use the psf-model to measure FWHM stats
     if (psf) {
-	psphotPSFstats (readout, recipe, psf);
-    } else {
-	psphotMomentsStats (readout, recipe, sources);
+	if (!psphotPSFstats (readout, recipe, psf)) {
+	    psError(PS_ERR_IO, true, "Failed to measure PSF shape parameters");
+	    return false;
+	}
+    } else if (sources) {
+	if (!psphotMomentsStats (readout, recipe, sources)) {
+	    psError(PS_ERR_IO, true, "Failed to measure Moment shape parameters");
+	    return false;
+	}
     }
 
