Index: trunk/ppSub/src/ppSubMatchPSFs.c
===================================================================
--- trunk/ppSub/src/ppSubMatchPSFs.c	(revision 23505)
+++ trunk/ppSub/src/ppSubMatchPSFs.c	(revision 23688)
@@ -22,5 +22,5 @@
 #include "ppSub.h"
 
-bool ppSubMatchPSFs(pmConfig *config, const pmFPAview *view)
+bool ppSubMatchPSFs(pmConfig *config, ppSubData *data, const pmFPAview *view)
 {
     psAssert(config, "Require configuration");
@@ -136,15 +136,27 @@
 
     // Match the PSFs
+    bool success = false;               // Operation was successful?
     if (kernelRO) {
-        if (!pmSubtractionMatchPrecalc(inConv, refConv, inRO, refRO, kernelRO->analysis,
-                                       stride, sys, maskVal, maskBad, maskPoor, poorFrac, badFrac)) {
-            psError(PS_ERR_UNKNOWN, false, "Unable to convolve images.");
-            return false;
-        }
+        success = pmSubtractionMatchPrecalc(inConv, refConv, inRO, refRO, kernelRO->analysis,
+                                            stride, sys, maskVal, maskBad, maskPoor, poorFrac, badFrac);
     } else {
-        if (!pmSubtractionMatch(inConv, refConv, inRO, refRO, footprint, stride, regionSize, spacing,
-                                threshold, sources, stampsName, type, size, order, widths, orders, inner,
-                                ringsOrder, binning, penalty, optimum, optWidths, optOrder, optThresh, iter,
-                                rej, sys, maskVal, maskBad, maskPoor, poorFrac, badFrac, subMode)) {
+        success = pmSubtractionMatch(inConv, refConv, inRO, refRO, footprint, stride, regionSize,
+                                     spacing, threshold, sources, stampsName, type, size, order,
+                                     widths, orders, inner, ringsOrder, binning, penalty, optimum,
+                                     optWidths, optOrder, optThresh, iter, rej, sys, maskVal,
+                                     maskBad, maskPoor, poorFrac, badFrac, subMode);
+    }
+
+    psFree(optWidths);
+    pmSubtractionThreadsFinalize(inRO, refRO);
+
+    if (!success) {
+        psErrorCode error = psErrorCodeLast(); // Error code
+        if (error == PM_ERR_STAMPS) {
+            psErrorStackPrint(stderr, "Unable to find stamps");
+            psWarning("Unable to find stamps --- suspect bad data quality.");
+            ppSubDataQuality(config, data, error, PPSUB_FILES_ALL);
+            return true;
+        } else {
             psError(PS_ERR_UNKNOWN, false, "Unable to match images.");
             return false;
@@ -152,19 +164,7 @@
     }
 
-    psFree(optWidths);
-
-    pmSubtractionThreadsFinalize(inRO, refRO);
-
     psImageCovarianceTransfer(inConv->variance, inConv->covariance);
     psImageCovarianceTransfer(refConv->variance, refConv->covariance);
 
-    // XXX drop the pixels associated with inRO and refRO (now that we have inConv and refConf)
-#ifdef TESTING
-    psphotSaveImage (NULL, inRO->image, "inRO.fits");
-    psphotSaveImage (NULL, refRO->image, "refRO.fits");
-    psphotSaveImage (NULL, inConv->image, "inConv.fits");
-    psphotSaveImage (NULL, refConv->image, "refConv.fits");
-#endif
-
     return true;
 }
