Index: trunk/ppImage/src/ppImageOptions.c
===================================================================
--- trunk/ppImage/src/ppImageOptions.c	(revision 29926)
+++ trunk/ppImage/src/ppImageOptions.c	(revision 29968)
@@ -216,8 +216,8 @@
 
     // for these images, even if not required otherwise
-    options->doMaskBuild = psMetadataLookupBool(NULL, recipe, "MASK.BUILD");
-    options->doMaskSat   = psMetadataLookupBool(NULL, recipe, "MASK.SATURATED");
-    options->doMaskLow   = psMetadataLookupBool(NULL, recipe, "MASK.LOW");
-    options->doMaskBurntool = psMetadataLookupBool(NULL, recipe, "MASK.BURNTOOL");
+    options->doMaskBuild     = psMetadataLookupBool(NULL, recipe, "MASK.BUILD");
+    options->doMaskSat       = psMetadataLookupBool(NULL, recipe, "MASK.SATURATED");
+    options->doMaskLow       = psMetadataLookupBool(NULL, recipe, "MASK.LOW");
+    options->doMaskBurntool  = psMetadataLookupBool(NULL, recipe, "MASK.BURNTOOL");
     options->doVarianceBuild = psMetadataLookupBool(NULL, recipe, "VARIANCE.BUILD");
 
@@ -313,11 +313,8 @@
      */
 
-    // even if not requested explicitly, if any of these are set, build an internal mask and variance:
-    // XXX we used to automatically generate a mask in all of these cases.
-    // if (options->doNoiseMap || options->doBias || options->doOverscan || options->doDark || options->doShutter || options->doFlat || options->doPhotom) {
-    //     options->doMaskBuild = true;
-    //     options->doVarianceBuild = true;
-    // }
-
+    // if the variance image is requested, build it (if not supplied)
+    if (options->BaseVarianceFITS || options->ChipVarianceFITS) {
+        options->doVarianceBuild = true;
+    } 
     // photometry and noisemap both require a variance image
     if (options->doNoiseMap || options->doPhotom) {
@@ -325,4 +322,8 @@
     } 
 
+    // we need a mask if we are going to apply these things:
+    if (options->doMaskSat || options->doMaskLow || options->doMaskBurntool || options->doMaskStats) {
+        options->doMaskBuild = true;
+    }
     // photometry, mask, and background all require a mask image
     if (options->doMask || options->doBG || options->doPhotom) {
