Index: trunk/psphot/src/psphotParseCamera.c
===================================================================
--- trunk/psphot/src/psphotParseCamera.c	(revision 13528)
+++ trunk/psphot/src/psphotParseCamera.c	(revision 18555)
@@ -17,10 +17,28 @@
     // if MASK or WEIGHT was supplied on command line, bind files to 'load'
     // the mask and weight will be mosaicked with the image
-    pmFPAfileBindFromArgs (&status, load, config, "PSPHOT.MASK",   "MASK");
+    pmFPAfile *mask = pmFPAfileBindFromArgs (&status, load, config, "PSPHOT.MASK", "MASK");
     if (!status) {
 	psError (PS_ERR_UNKNOWN, false, "failed to load find definition");
 	return NULL;
     }
-
+    if (mask) {
+	// XXX need to load the mask bit names from one of the headers
+	// this grabs the first available hdu : no guarantee that it will be valid, though
+	pmHDU *hdu = pmHDUGetFirst (mask->fpa);
+	if (!hdu) {
+	    psError(PS_ERR_IO, true, "no valid HDU for PSPHOT.MASK");
+	    return NULL;
+	}
+	// XXX should this be done in pmFPAfileIO.c read functions?
+	if (!pmConfigMaskReadHeader (config, hdu->header)) {
+	    psError(PS_ERR_IO, false, "error in mask bits");
+	    return NULL;
+	}
+    }
+    if (!psphotSetMaskBits (config)) {
+	psError (PS_ERR_UNKNOWN, false, "failed to set mask bit values");
+	return NULL;
+    }
+    
     pmFPAfileBindFromArgs (&status, load, config, "PSPHOT.WEIGHT", "WEIGHT");
     if (!status) {
