Index: trunk/ppMerge/src/ppMergeLoop.c
===================================================================
--- trunk/ppMerge/src/ppMergeLoop.c	(revision 18166)
+++ trunk/ppMerge/src/ppMergeLoop.c	(revision 18558)
@@ -39,5 +39,4 @@
     float frachigh = psMetadataLookupF32(NULL, arguments, "FRACHIGH"); // Reject fraction of hi pixels
     int nKeep = psMetadataLookupS32(NULL, arguments, "NKEEP"); // Minimum number of values to keep
-    psMaskType maskVal = psMetadataLookupU8(NULL, arguments, "MASKVAL"); // Value to mask
     psStatsOptions combineStat = psMetadataLookupS32(NULL, arguments, "COMBINE"); // Combination statistic
     bool useWeights = psMetadataLookupBool(NULL, arguments, "WEIGHTS"); // Use weights?
@@ -49,7 +48,15 @@
     int fringeSmoothY = psMetadataLookupS32(NULL, arguments, "FRINGE.YSMOOTH"); // Smoothing regions in y
 
+    // set the mask and mark bit values based on the named masks
+    psMaskType maskVal;
+    psMaskType markVal;
+    if (!pmConfigMaskSetBits (&maskVal, &markVal, config)) {
+	psError (PS_ERR_UNKNOWN, true, "Unable to define the mask bit values");
+	return false;
+    }
+
     pmCombineParams *combination = pmCombineParamsAlloc(combineStat); // Combination parameters
     combination->maskVal = maskVal;
-    combination->blank = pmConfigMask("BLANK", config);
+    combination->blank = pmConfigMaskGet("BLANK", config);
     combination->nKeep = nKeep;
     combination->fracHigh = frachigh;
@@ -294,5 +301,5 @@
             }
 
-            if (!ppStatsFPA(stats, outFPA, view, maskVal | pmConfigMask("BLANK", config), config)) {
+            if (!ppStatsFPA(stats, outFPA, view, maskVal, config)) {
                 psError(PS_ERR_UNKNOWN, true, "Unable to generate stats for image.");
                 goto ERROR;
