Index: /trunk/psphot/src/psphotReadout.c
===================================================================
--- /trunk/psphot/src/psphotReadout.c	(revision 7505)
+++ /trunk/psphot/src/psphotReadout.c	(revision 7506)
@@ -21,10 +21,10 @@
     psphotModelTest (readout, recipe);
 
-    // generate a background model (median, smoothed image)
-    psphotImageMedian (config, view);
-
     // psphotSaveImage (NULL, readout->image,  "image.fits");
     // psphotSaveImage (NULL, readout->mask,   "mask.fits");
     // psphotSaveImage (NULL, readout->weight, "weight.fits");
+
+    // generate a background model (median, smoothed image)
+    psphotImageMedian (config, view);
 
     // find the peaks in the image
@@ -37,5 +37,12 @@
     // classify sources based on moments, brightness
     // faint sources not classified?
-    psphotRoughClass (sources, recipe);
+    if (!psphotRoughClass (sources, recipe)) {
+	psFree (peaks);
+	psFree (sources);
+	psLogMsg ("psphot", 3, "failed to find a valid PSF clump for image");
+	pmFPAfileDropInternal (config->files, "PSPHOT.BACKMDL");
+	pmFPAfileDropInternal (config->files, "PSPHOT.BACKGND");
+	return false;
+    }
 
     // mark blended peaks PS_SOURCE_BLEND
