Index: trunk/ppImage/src/ppImageParseCamera.c
===================================================================
--- trunk/ppImage/src/ppImageParseCamera.c	(revision 18896)
+++ trunk/ppImage/src/ppImageParseCamera.c	(revision 20444)
@@ -74,25 +74,25 @@
             return NULL;
         }
-	// XXX have ppImageDefineFile return the pmFPAfile?
-	pmFPAfile *mask = psMetadataLookupPtr(&status, config->files, "PPIMAGE.MASK");
-	psAssert (mask, "mask not defined?  not possible!");
-
-	// Need to read the names of bit masks from the mask header and set them in the
-	// recipe.  If we are loading this from the detrend db, this action will happen
-	// when the file is resolved.
-	if (!mask->detrend) {
-	    // 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 PPIMAGE.INPUT.MASK");
-		return NULL;
-	    }
-	    // XXX is this consistent with the pmConfigMaskReadHeader call above?
-	    if (!pmConfigMaskReadHeader (config, hdu->header)) {
-		psError(PS_ERR_IO, false, "error in mask bits");
-		return NULL;
-	    }
-	}
+        // XXX have ppImageDefineFile return the pmFPAfile?
+        pmFPAfile *mask = psMetadataLookupPtr(&status, config->files, "PPIMAGE.MASK");
+        psAssert (mask, "mask not defined?  not possible!");
+
+        // Need to read the names of bit masks from the mask header and set them in the
+        // recipe.  If we are loading this from the detrend db, this action will happen
+        // when the file is resolved.
+        if (!mask->detrend) {
+            // 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 PPIMAGE.INPUT.MASK");
+                return NULL;
+            }
+            // XXX is this consistent with the pmConfigMaskReadHeader call above?
+            if (!pmConfigMaskReadHeader (config, hdu->header)) {
+                psError(PS_ERR_IO, false, "error in mask bits");
+                return NULL;
+            }
+        }
     }
     if (options->doShutter) {
@@ -114,6 +114,6 @@
     int nThreads = psMetadataLookupS32 (&status, config->arguments, "NTHREADS");
     if (nThreads > 0) {
-	int nScanRows = psMetadataLookupS32 (&status, recipe, "SCAN.ROWS");
-	pmDetrendSetThreadTasks (nScanRows);
+        int nScanRows = psMetadataLookupS32 (&status, recipe, "SCAN.ROWS");
+        pmDetrendSetThreadTasks (nScanRows);
     }
 
@@ -274,5 +274,5 @@
     // For photometry, we operate on the chip-mosaicked image
     // we create a copy of the mosaicked image for psphot so we can write out a clean image
-    if (options->doPhotom) {
+    if (options->doPhotom || options->doBG) {
 
         // this file is just used as a carrier; output files (eg, PSPHOT.RESID) are defined by
