Index: trunk/ppStack/src/ppStackMatch.c
===================================================================
--- trunk/ppStack/src/ppStackMatch.c	(revision 28253)
+++ trunk/ppStack/src/ppStackMatch.c	(revision 29552)
@@ -68,5 +68,5 @@
 
     // user-defined masks to test for good/bad pixels (build from recipe list if not yet set)
-    psMetadataAddU8(psphotRecipe, PS_LIST_TAIL, "MASK.PSPHOT", PS_META_REPLACE, "user-defined mask", maskBad);
+    psMetadataAddImageMask(psphotRecipe, PS_LIST_TAIL, "MASK.PSPHOT", PS_META_REPLACE, "user-defined mask", maskBad);
 
     psImage *binned = psphotModelBackgroundReadoutNoFile(ro, config); // Binned background model
@@ -153,5 +153,6 @@
     int threads = psMetadataLookupS32(NULL, config->arguments, "-threads"); // Number of threads
 
-    if (!pmReadoutMaskNonfinite(readout, maskVal)) {
+    // Replaced pmReadoutMaskNonfinite with pmReadoutMaskInvalid (tests for already masked pixels)
+    if (!pmReadoutMaskInvalid(readout, maskVal, maskBad)) {
         psError(psErrorCodeLast(), false, "Unable to mask non-finite pixels in readout.");
         return false;
@@ -319,9 +320,10 @@
                 }
             } else {
+		// we need to register the FWHM values for use downstream 
+		pmSubtractionSetFWHMs(options->inputSeeing->data.F32[index], options->targetSeeing);
+
                 // Scale the input parameters
                 psVector *widthsCopy = psVectorCopy(NULL, widths, PS_TYPE_F32); // Copy of kernel widths
-                if (scale && !pmSubtractionParamsScale(&size, &footprint, widthsCopy,
-                                                       options->inputSeeing->data.F32[index],
-                                                       options->targetSeeing, scaleRef, scaleMin, scaleMax)) {
+                if (scale && !pmSubtractionParamsScale(&size, &footprint, widthsCopy, scaleRef, scaleMin, scaleMax)) {
                     psError(psErrorCodeLast(), false, "Unable to scale kernel parameters");
                     psFree(fake);
