Index: trunk/psModules/src/imcombine/pmReadoutCombine.c
===================================================================
--- trunk/psModules/src/imcombine/pmReadoutCombine.c	(revision 14352)
+++ trunk/psModules/src/imcombine/pmReadoutCombine.c	(revision 14355)
@@ -254,4 +254,11 @@
                 }
 
+                // Check mask
+                psImage *roMask = readout->mask; // The mask image
+                if (roMask && roMask->data.U8[yIn][xIn] & maskVal) {
+                    maskData[r] = 1;
+                    continue;
+                }
+
                 if (params->weights) {
                     weightsData[r] = readout->weight->data.F32[yIn][xIn];
@@ -266,11 +273,4 @@
                         weightsData[r] *= invScale->data.F32[r] * invScale->data.F32[r];
                     }
-                }
-
-                // Check mask
-                psImage *roMask = readout->mask; // The mask image
-                if (roMask && roMask->data.U8[yIn][xIn] & maskVal) {
-                    maskData[r] = 1;
-                    continue;
                 }
 
@@ -327,4 +327,7 @@
 
             outputImage[yOut][xOut] = psStatsGetValue(stats, params->combine);
+            if (!isfinite(outputImage[yOut][xOut])) {
+                outputMask[yOut][xOut] = params->blank;
+            }
             if (params->weights) {
                 float stdev = psStatsGetValue(stats, combineStdev);
