Index: trunk/psModules/src/objects/pmSource.c
===================================================================
--- trunk/psModules/src/objects/pmSource.c	(revision 33963)
+++ trunk/psModules/src/objects/pmSource.c	(revision 33993)
@@ -51,5 +51,7 @@
     psFree(tmp->pixels);
     psFree(tmp->variance);
+# if (HAVE_MODEL_VAR)
     psFree(tmp->modelVar);
+# endif
     psFree(tmp->maskObj);
     psFree(tmp->maskView);
@@ -78,5 +80,7 @@
     psFree (source->pixels);
     psFree (source->variance);
+# if (HAVE_MODEL_VAR)
     psFree (source->modelVar);
+# endif
     psFree (source->maskObj);
     psFree (source->maskView);
@@ -86,5 +90,7 @@
     source->pixels = NULL;
     source->variance = NULL;
+# if (HAVE_MODEL_VAR)
     source->modelVar = NULL;
+# endif
     source->maskObj = NULL;
     source->maskView = NULL;
@@ -116,5 +122,7 @@
     source->pixels = NULL;
     source->variance = NULL;
+# if (HAVE_MODEL_VAR)
     source->modelVar = NULL;
+# endif
     source->maskObj = NULL;
     source->maskView = NULL;
@@ -204,5 +212,7 @@
     source->pixels   = in->pixels   ? psImageCopyView(NULL, in->pixels)   : NULL;
     source->variance = in->variance ? psImageCopyView(NULL, in->variance) : NULL;
+# if (HAVE_MODEL_VAR)
     source->modelVar = NULL;
+# endif
     source->maskView = in->maskView ? psImageCopyView(NULL, in->maskView) : NULL;
 
@@ -1033,7 +1043,9 @@
 
     bool addNoise = mode & PM_MODEL_OP_NOISE;
+
+# if (HAVE_MODEL_VAR)
     bool addModelVar = mode & PM_MODEL_OP_MODELVAR;
-
     if (addModelVar) psAssert (source->modelVar, "programming error");
+# endif
 
     // require the use of pmModelAddWithOffset if we are adding noise (because the model size and norm are rescaled)
@@ -1058,5 +1070,9 @@
         }
 
+# if (HAVE_MODEL_VAR)
         psF32 **target = addModelVar ? source->modelVar->data.F32 : source->pixels->data.F32;
+# else
+        psF32 **target = source->pixels->data.F32;
+# endif
 
         for (int iy = 0; iy < source->modelFlux->numRows; iy++) {
@@ -1073,4 +1089,5 @@
             }
         }
+# if (HAVE_MODEL_VAR)
 	if (!addModelVar) {
 	    if (add) {
@@ -1080,4 +1097,11 @@
 	    }
 	}
+# else
+	if (add) {
+	    source->tmpFlags &= ~PM_SOURCE_TMPF_SUBTRACTED;
+	} else {
+	    source->tmpFlags |= PM_SOURCE_TMPF_SUBTRACTED;
+	}
+# endif
         return true;
     }
@@ -1087,14 +1111,24 @@
         target = source->variance;
     }
+# if (HAVE_MODEL_VAR)
     if (addModelVar) {
         target = source->modelVar;
     }
+# endif
 
     if (add) {
 	status = pmModelAddWithOffset (target, source->maskObj, model, PM_MODEL_OP_FULL, maskVal, dx, dy);
+# if (HAVE_MODEL_VAR)
 	if (!addNoise && !addModelVar) source->tmpFlags &= ~PM_SOURCE_TMPF_SUBTRACTED;
+# else
+	source->tmpFlags &= ~PM_SOURCE_TMPF_SUBTRACTED;
+# endif
     } else {
 	status = pmModelSubWithOffset (target, source->maskObj, model, PM_MODEL_OP_FULL, maskVal, dx, dy);
+# if (HAVE_MODEL_VAR)
 	if (!addNoise && !addModelVar) source->tmpFlags |= PM_SOURCE_TMPF_SUBTRACTED;
+# else
+	source->tmpFlags |= PM_SOURCE_TMPF_SUBTRACTED;
+# endif
     }
 
