Index: trunk/psModules/src/camera/pmFPAMaskWeight.c
===================================================================
--- trunk/psModules/src/camera/pmFPAMaskWeight.c	(revision 7017)
+++ trunk/psModules/src/camera/pmFPAMaskWeight.c	(revision 7275)
@@ -18,9 +18,10 @@
         return false;
     }
-    float bad = psMetadataLookupF32(NULL, cell->concepts, "CELL.BAD"); // Bad level
+    float bad = psMetadataLookupF32(&mdok, cell->concepts, "CELL.BAD"); // Bad level
     if (!mdok || isnan(bad)) {
         psError(PS_ERR_IO, true, "CELL.BAD is not set --- unable to set mask.\n");
         return false;
     }
+    psTrace(__func__, 5, "Saturation: %f, bad: %f\n", saturation, bad);
 
     psImage *image = readout->image;    // The image pixels
@@ -35,8 +36,8 @@
     for (int i = 0; i < image->numRows; i++) {
         for (int j = 0; j < image->numCols; j++) {
-            if (image->data.F32[i][j] > saturation) {
+            if (image->data.F32[i][j] >= saturation) {
                 mask->data.U8[i][j] |= PM_MASK_SAT;
             }
-            if (image->data.F32[i][j] < bad) {
+            if (image->data.F32[i][j] <= bad) {
                 mask->data.U8[i][j] |= PM_MASK_BAD;
             }
