Index: /branches/czw_branch/20170908/psphot/src/psphotReadout.c
===================================================================
--- /branches/czw_branch/20170908/psphot/src/psphotReadout.c	(revision 40478)
+++ /branches/czw_branch/20170908/psphot/src/psphotReadout.c	(revision 40479)
@@ -94,4 +94,5 @@
     // generate a background model (median, smoothed image)
     if (!psphotModelBackground (config, view, filerule)) {
+      // XXX this should result in a bad quality flag
         return psphotReadoutCleanup (config, view, filerule);
     }
Index: /branches/czw_branch/20170908/psphot/src/psphotReadoutCleanup.c
===================================================================
--- /branches/czw_branch/20170908/psphot/src/psphotReadoutCleanup.c	(revision 40478)
+++ /branches/czw_branch/20170908/psphot/src/psphotReadoutCleanup.c	(revision 40479)
@@ -55,4 +55,6 @@
     // XXX where do we free these, in here (psMetadataRemove?)
 
+    // XXX this is currently only set by psphotModelBackground / psphotModelBackgroundReadoutFileIndex / psphotModelBackgroundReadout
+    // if the image background cannot be measured (no valid pixels)
     int quality = psMetadataLookupS32 (&status, readout->analysis, "PSPHOT_QUALITY");
     if (quality) {
@@ -74,4 +76,11 @@
             return false;
         }
+    }
+
+    // Check to see if any sources were detected
+    // This is not necessarily a quality error: e.g., ppSub
+    if (0 && !psf && !sources) {
+      psError(PSPHOT_ERR_DATA, false, "Unable to detect sources in the image");
+      return false;
     }
 
@@ -115,4 +124,6 @@
 
     psFree (header);
+    if (quality) return false;
+
     return true;
 }
