Index: branches/eam_branches/ipp-20120601/ippTasks/addstar.pro
===================================================================
--- branches/eam_branches/ipp-20120601/ippTasks/addstar.pro	(revision 34048)
+++ branches/eam_branches/ipp-20120601/ippTasks/addstar.pro	(revision 34049)
@@ -321,5 +321,5 @@
     end
     if ("$STAGE" == "staticsky")
-      $run = $run --multi_num $STAGE_EXTRA1
+      $run = $run --stage_extra1 $STAGE_EXTRA1  --stage_id $STAGE_ID
     end
     if ("$STAGE" == "cam") 
Index: branches/eam_branches/ipp-20120601/psModules/src/objects/pmModelFuncs.h
===================================================================
--- branches/eam_branches/ipp-20120601/psModules/src/objects/pmModelFuncs.h	(revision 34048)
+++ branches/eam_branches/ipp-20120601/psModules/src/objects/pmModelFuncs.h	(revision 34049)
@@ -29,4 +29,6 @@
 # define PM_MODEL_FUNCS_H
 
+# define HAVE_MODEL_VAR 1
+
 /// @addtogroup Objects Object Detection / Analysis Functions
 /// @{
@@ -55,5 +57,7 @@
     PM_MODEL_OP_NORM     = 0x20,
     PM_MODEL_OP_NOISE    = 0x40,
+# if (HAVE_MODEL_VAR)
     PM_MODEL_OP_MODELVAR = 0x80,
+# endif
 } pmModelOpMode;
 
Index: branches/eam_branches/ipp-20120601/psModules/src/objects/pmSource.c
===================================================================
--- branches/eam_branches/ipp-20120601/psModules/src/objects/pmSource.c	(revision 34048)
+++ branches/eam_branches/ipp-20120601/psModules/src/objects/pmSource.c	(revision 34049)
@@ -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
     }
     if (!status) {
Index: branches/eam_branches/ipp-20120601/psModules/src/objects/pmSource.h
===================================================================
--- branches/eam_branches/ipp-20120601/psModules/src/objects/pmSource.h	(revision 34048)
+++ branches/eam_branches/ipp-20120601/psModules/src/objects/pmSource.h	(revision 34049)
@@ -72,5 +72,7 @@
     psImage *pixels;                    ///< Rectangular region including object pixels.
     psImage *variance;			///< Image variance.
+# if (HAVE_MODEL_VAR)
     psImage *modelVar;			///< variance based on current models
+# endif
     psImage *maskObj;                   ///< unique mask for this object which marks included pixels associated with objects.
     psImage *maskView;                  ///< view into global image mask for this object region
Index: branches/eam_branches/ipp-20120601/psModules/src/objects/pmSourcePhotometry.c
===================================================================
--- branches/eam_branches/ipp-20120601/psModules/src/objects/pmSourcePhotometry.c	(revision 34048)
+++ branches/eam_branches/ipp-20120601/psModules/src/objects/pmSourcePhotometry.c	(revision 34049)
@@ -899,12 +899,21 @@
 }
 
+# if (HAVE_MODEL_VAR) 
 double pmSourceModelWeight(const pmSource *Mi, int term, const pmSourceFitVarMode fitVarMode, const float covarFactor, psImageMaskType maskVal)
+# else
+double pmSourceModelWeight(const pmSource *Mi, int term, const bool unweighted_sum, const float covarFactor, psImageMaskType maskVal)
+# endif
 {
     PS_ASSERT_PTR_NON_NULL(Mi, NAN);
+# if (HAVE_MODEL_VAR) 
     double flux = 0, wt = 1.0, factor = 0;
+# else
+    double flux = 0, wt = 0, factor = 0;
+# endif
 
     const psImage *Pi = Mi->modelFlux;
     assert (Pi != NULL);
 
+# if (HAVE_MODEL_VAR)
     const psImage *Wi = NULL;
     switch (fitVarMode) {
@@ -922,5 +931,10 @@
 	psAbort("programming error");
     }	
-
+# else
+    const psImage *Wi = Mi->variance;
+    if (!unweighted_sum) {
+        assert (Wi != NULL);
+    }
+# endif
     const psImage *Ti = Mi->maskObj;
     assert (Ti != NULL);
@@ -928,9 +942,18 @@
     for (int yi = 0; yi < Pi->numRows; yi++) {
         for (int xi = 0; xi < Pi->numCols; xi++) {
-            if (Ti->data.PS_TYPE_IMAGE_MASK_DATA[yi][xi] & maskVal) continue;
+            if (Ti->data.PS_TYPE_IMAGE_MASK_DATA[yi][xi] & maskVal)
+                continue;
+# if (HAVE_MODEL_VAR)
             if (fitVarMode != PM_SOURCE_PHOTFIT_CONST) {
                 wt = covarFactor * Wi->data.F32[yi][xi];
                 if (wt == 0) continue;
             }
+# else
+            if (!unweighted_sum) {
+                wt = covarFactor * Wi->data.F32[yi][xi];
+                if (wt == 0)
+                    continue;
+            }
+# endif
 
             switch (term) {
@@ -948,6 +971,14 @@
             }
 
+# if (HAVE_MODEL_VAR)
 	    // wt is 1.0 for CONST
 	    flux += (factor * Pi->data.F32[yi][xi]) / wt;
+# else
+            if (unweighted_sum) {
+                flux += (factor * Pi->data.F32[yi][xi]);
+            } else {
+                flux += (factor * Pi->data.F32[yi][xi]) / wt;
+            }
+# endif
         }
     }
@@ -955,5 +986,9 @@
 }
 
+# if (HAVE_MODEL_VAR)
 double pmSourceModelDotModel (const pmSource *Mi, const pmSource *Mj, const pmSourceFitVarMode fitVarMode, const float covarFactor, psImageMaskType maskVal)
+# else
+double pmSourceModelDotModel (const pmSource *Mi, const pmSource *Mj, const bool unweighted_sum, const float covarFactor, psImageMaskType maskVal)
+# endif
 {
     PS_ASSERT_PTR_NON_NULL(Mi, NAN);
@@ -963,6 +998,10 @@
     int xIs, xJs, yIs, yJs;
     int xIe, yIe;
+# if (HAVE_MODEL_VAR)
     double flux;
     double wt = 1.0;
+# else
+    double flux, wt;
+# endif
 
     const psImage *Pi = Mi->modelFlux;
@@ -971,4 +1010,5 @@
     assert (Pj != NULL);
 
+# if (HAVE_MODEL_VAR)
     const psImage *Wi = NULL;
     switch (fitVarMode) {
@@ -986,4 +1026,10 @@
 	psAbort("programming error");
     }	
+# else
+    const psImage *Wi = Mi->variance;
+    if (!unweighted_sum) {
+        assert (Wi != NULL);
+    }
+# endif
 
     const psImage *Ti = Mi->maskObj;
@@ -1015,4 +1061,5 @@
                 continue;
 
+# if (HAVE_MODEL_VAR)
 	    float value = (Pi->data.F32[yi][xi] * Pj->data.F32[yj][xj]);
 	    switch (fitVarMode) {
@@ -1031,4 +1078,15 @@
 
 	    flux += value / wt;
+# else
+            // XXX skip the nonsense weight pixels?
+            if (unweighted_sum) {
+                flux += (Pi->data.F32[yi][xi] * Pj->data.F32[yj][xj]);
+            } else {
+                wt = covarFactor * Wi->data.F32[yi][xi];
+                if (wt > 0) {
+                    flux += (Pi->data.F32[yi][xi] * Pj->data.F32[yj][xj]) / wt;
+                }
+            }
+# endif
         }
     }
@@ -1036,5 +1094,9 @@
 }
 
+# if (HAVE_MODEL_VAR)
 double pmSourceDataDotModel (const pmSource *Mi, const pmSource *Mj, const pmSourceFitVarMode fitVarMode, const float covarFactor, psImageMaskType maskVal)
+# else
+double pmSourceDataDotModel (const pmSource *Mi, const pmSource *Mj, const bool unweighted_sum, const float covarFactor, psImageMaskType maskVal)
+# endif
 {
     PS_ASSERT_PTR_NON_NULL(Mi, NAN);
@@ -1044,6 +1106,10 @@
     int xIs, xJs, yIs, yJs;
     int xIe, yIe;
+# if (HAVE_MODEL_VAR)
     double flux;
     double wt = 1.0;
+# else
+    double flux, wt;
+# endif
 
     const psImage *Pi = Mi->pixels;
@@ -1052,4 +1118,5 @@
     assert (Pj != NULL);
 
+# if (HAVE_MODEL_VAR)
     const psImage *Wi = NULL;
     switch (fitVarMode) {
@@ -1067,4 +1134,10 @@
 	psAbort("programming error");
     }	
+# else
+    const psImage *Wi = Mi->variance;
+    if (!unweighted_sum) {
+        assert (Wi != NULL);
+    }
+# endif
 
     const psImage *Ti = Mi->maskObj;
@@ -1096,4 +1169,5 @@
                 continue;
 
+# if (HAVE_MODEL_VAR)
 	    float value = (Pi->data.F32[yi][xi] * Pj->data.F32[yj][xj]);
 	    switch (fitVarMode) {
@@ -1113,4 +1187,15 @@
 	    flux += value / wt;
 
+# else
+            // XXX skip the nonsense weight pixels?
+            if (unweighted_sum) {
+                flux += (Pi->data.F32[yi][xi] * Pj->data.F32[yj][xj]);
+            } else {
+                wt = covarFactor * Wi->data.F32[yi][xi];
+                if (wt > 0) {
+                    flux += (Pi->data.F32[yi][xi] * Pj->data.F32[yj][xj]) / wt;
+                }
+            }
+# endif
         }
     }
Index: branches/eam_branches/ipp-20120601/psModules/src/objects/pmSourcePhotometry.h
===================================================================
--- branches/eam_branches/ipp-20120601/psModules/src/objects/pmSourcePhotometry.h	(revision 34048)
+++ branches/eam_branches/ipp-20120601/psModules/src/objects/pmSourcePhotometry.h	(revision 34049)
@@ -38,4 +38,5 @@
 } pmSourcePhotometryMode;
 
+# if (HAVE_MODEL_VAR)
 typedef enum {
     PM_SOURCE_PHOTFIT_NONE       = 0,
@@ -44,4 +45,5 @@
     PM_SOURCE_PHOTFIT_MODEL_VAR  = 3,
 } pmSourceFitVarMode;
+# endif
 
 bool pmSourcePhotometryModel(
@@ -82,7 +84,13 @@
 bool pmSourceMeasureDiffStats (pmSource *source, psImageMaskType maskVal, psImageMaskType markVal);
 
+# if (HAVE_MODEL_VAR)
 double pmSourceDataDotModel (const pmSource *Mi, const pmSource *Mj, const pmSourceFitVarMode fitVarMode, const float covarFactor, psImageMaskType maskVal);
 double pmSourceModelDotModel (const pmSource *Mi, const pmSource *Mj, const pmSourceFitVarMode fitVarMode, const float covarFactor, psImageMaskType maskVal);
 double pmSourceModelWeight(const pmSource *Mi, int term, const pmSourceFitVarMode fitVarMode, const float covarFactor, psImageMaskType maskVal);
+# else
+double pmSourceDataDotModel (const pmSource *Mi, const pmSource *Mj, const bool unweighted_sum, const float covarFactor, psImageMaskType maskVal);
+double pmSourceModelDotModel (const pmSource *Mi, const pmSource *Mj, const bool unweighted_sum, const float covarFactor, psImageMaskType maskVal);
+double pmSourceModelWeight(const pmSource *Mi, int term, const bool unweighted_sum, const float covarFactor, psImageMaskType maskVal);
+# endif
 
 bool pmSourceNeighborFlags (pmSource *source);
Index: branches/eam_branches/ipp-20120601/psphot/src/psphot.h
===================================================================
--- branches/eam_branches/ipp-20120601/psphot/src/psphot.h	(revision 34048)
+++ branches/eam_branches/ipp-20120601/psphot/src/psphot.h	(revision 34049)
@@ -99,5 +99,10 @@
 
 bool            psphotFitSourcesLinear (pmConfig *config, const pmFPAview *view, const char *filerule, bool final);
+
+# if (HAVE_MODEL_VAR)
 bool            psphotFitSourcesLinearReadout (psMetadata *recipe, pmReadout *readout, psArray *sources, pmPSF *psf, bool final, pmSourceFitVarMode fitVarMode);
+# else
+bool            psphotFitSourcesLinearReadout (psMetadata *recipe, pmReadout *readout, psArray *sources, pmPSF *psf, bool final);
+# endif
 
 bool            psphotSourceSize (pmConfig *config, const pmFPAview *view, const char *filerule, bool getPSFsize);
Index: branches/eam_branches/ipp-20120601/psphot/src/psphotAddNoise.c
===================================================================
--- branches/eam_branches/ipp-20120601/psphot/src/psphotAddNoise.c	(revision 34048)
+++ branches/eam_branches/ipp-20120601/psphot/src/psphotAddNoise.c	(revision 34049)
@@ -47,5 +47,7 @@
 
     psArray *sources = detections->allSources;
-    psAssert (sources, "missing sources?");
+    //psAssert (sources, "missing sources?");
+    // if no work, should just return true
+    if (!sources) return true;
 
     psTimerStart ("psphot.noise");
Index: branches/eam_branches/ipp-20120601/psphot/src/psphotEfficiency.c
===================================================================
--- branches/eam_branches/ipp-20120601/psphot/src/psphotEfficiency.c	(revision 34048)
+++ branches/eam_branches/ipp-20120601/psphot/src/psphotEfficiency.c	(revision 34049)
@@ -420,5 +420,9 @@
 
     // psphotFitSourcesLinearReadout subtracts the model fits
+# if (HAVE_MODEL_VAR)
     if (!psphotFitSourcesLinearReadout(recipe, readout, fakeSourcesAll, psf, true, PM_SOURCE_PHOTFIT_CONST)) {
+# else
+    if (!psphotFitSourcesLinearReadout(recipe, readout, fakeSourcesAll, psf, true)) {
+# endif
         psError(PS_ERR_UNKNOWN, false, "Unable to perform linear fit on fake sources.");
         psFree(fakeSources);
Index: branches/eam_branches/ipp-20120601/psphot/src/psphotFitSourcesLinear.c
===================================================================
--- branches/eam_branches/ipp-20120601/psphot/src/psphotFitSourcesLinear.c	(revision 34048)
+++ branches/eam_branches/ipp-20120601/psphot/src/psphotFitSourcesLinear.c	(revision 34049)
@@ -12,7 +12,9 @@
 static bool SetBorderMatrixElements (psSparseBorder *border, pmReadout *readout, psArray *sources, bool constant_weights, int SKY_FIT_ORDER, psImageMaskType markVal);
 
+# if (HAVE_MODEL_VAR)
 bool psphotGenerateModelVariance (pmConfig *config, const pmFPAview *view, pmFPAfile *file, int index, psMetadata *recipe, pmReadout *readout, psArray *sources);
 pmSourceFitVarMode psphotGetFitVarMode (psMetadata *recipe);
 bool psphotFreeModelVariance (pmReadout *readout, psArray *sources);
+# endif
 
 // for now, let's store the detections on the readout->analysis for each readout
@@ -28,4 +30,5 @@
     assert (recipe);
 
+# if (HAVE_MODEL_VAR)
     pmSourceFitVarMode fitVarMode = psphotGetFitVarMode (recipe);
     if (!fitVarMode) {
@@ -37,4 +40,5 @@
     // do a single pass.
     pmSourceFitVarMode fitVarModePass1 = (fitVarMode == PM_SOURCE_PHOTFIT_MODEL_VAR) ? PM_SOURCE_PHOTFIT_CONST : fitVarMode;
+# endif
 
     int num = psphotFileruleCount(config, filerule);
@@ -64,9 +68,15 @@
         psAssert (psf, "missing psf?");
 
-        if (!psphotFitSourcesLinearReadout (recipe, readout, sources, psf, final, fitVarModePass1)) {
+# if (HAVE_MODEL_VAR)
+        if (!psphotFitSourcesLinearReadout (recipe, readout, sources, psf, final, fitVarModePass1))
+# else
+        if (!psphotFitSourcesLinearReadout (recipe, readout, sources, psf, final))
+# endif
+	{
             psError (PSPHOT_ERR_CONFIG, false, "failed to fit sources (linear) for %s entry %d", filerule, i);
             return false;
         }
 
+# if (HAVE_MODEL_VAR)
 	// the MODEL_VAR weighting scheme requires knowledge of the model fluxes to generate the variance
 	// after we have determined the initial set of fits, then we can generate the variance image and 
@@ -94,4 +104,5 @@
 	    }
 	}
+# endif
 
 	psphotVisualShowResidualImage (readout, (num > 0)); 
@@ -102,4 +113,5 @@
 }
 
+# if (HAVE_MODEL_VAR)
 // look up the fit variance mode from the recipe; older recipes do not have the value
 // 'LINEAR_FIT_VARIANCE_MODE'; in those cases, look for 'CONSTANT_PHOTOMETRIC_WEIGHTS' as a boolean and
@@ -130,7 +142,12 @@
     return PM_SOURCE_PHOTFIT_NONE;
 }
-
-bool psphotFitSourcesLinearReadout (psMetadata *recipe, pmReadout *readout, psArray *sources, pmPSF *psf, bool final, pmSourceFitVarMode fitVarMode) {
-
+# endif
+
+# if (HAVE_MODEL_VAR)
+bool psphotFitSourcesLinearReadout (psMetadata *recipe, pmReadout *readout, psArray *sources, pmPSF *psf, bool final, pmSourceFitVarMode fitVarMode)
+# else
+bool psphotFitSourcesLinearReadout (psMetadata *recipe, pmReadout *readout, psArray *sources, pmPSF *psf, bool final)
+# endif
+{
     bool status;
     float x;
@@ -168,4 +185,11 @@
     if (psRegionIsNaN (AnalysisRegion)) psAbort("analysis region mis-defined");
 
+# if (!HAVE_MODEL_VAR)
+    bool CONSTANT_PHOTOMETRIC_WEIGHTS =
+        psMetadataLookupBool(&status, recipe, "CONSTANT_PHOTOMETRIC_WEIGHTS");
+    if (!status) {
+        psAbort("You must provide a value for the BOOL recipe CONSTANT_PHOTOMETRIC_WEIGHTS");
+    }
+# endif
     int SKY_FIT_ORDER = psMetadataLookupS32(&status, recipe, "SKY_FIT_ORDER");
     if (!status) {
@@ -295,4 +319,5 @@
     psSparseBorder *border = psSparseBorderAlloc (sparse, nBorder);
 
+# if (HAVE_MODEL_VAR)
     // if fitVarMode is MODEL_VAR, then we need to generate the model image variance
     // XXX we have two possibilities here: 
@@ -302,4 +327,5 @@
 
     // 2) do a single pass, and use the model guess to define the model variance (but do I trust the Model Guess?)
+# endif
 
     // fill out the sparse matrix elements and border elements (B)
@@ -310,7 +336,12 @@
 
         // diagonal elements of the sparse matrix (auto-cross-product)
+# if (HAVE_MODEL_VAR)
         f = pmSourceModelDotModel (SRCi, SRCi, fitVarMode, covarFactor, maskVal);
+# else
+        f = pmSourceModelDotModel (SRCi, SRCi, CONSTANT_PHOTOMETRIC_WEIGHTS, covarFactor, maskVal);
+# endif
         psSparseMatrixElement (sparse, i, i, f);
 
+# if (HAVE_MODEL_VAR)
         // if we have used CONSTANT errors, then we need to calculate the value of the parameter error
         if (fitVarMode != PM_SOURCE_PHOTFIT_IMAGE_VAR) {
@@ -320,8 +351,20 @@
             errors->data.F32[i] = 1.0 / sqrt(f);
         }
-
+# else
+        // the formal error depends on the weighting scheme
+        if (CONSTANT_PHOTOMETRIC_WEIGHTS) {
+            float var = pmSourceModelDotModel (SRCi, SRCi, false, covarFactor, maskVal);
+            errors->data.F32[i] = 1.0 / sqrt(var);
+        } else {
+            errors->data.F32[i] = 1.0 / sqrt(f);
+        }
+# endif
 
         // find the image x model value
+# if (HAVE_MODEL_VAR)
         f = pmSourceDataDotModel (SRCi, SRCi, fitVarMode, covarFactor, maskVal);
+# else
+        f = pmSourceDataDotModel (SRCi, SRCi, CONSTANT_PHOTOMETRIC_WEIGHTS, covarFactor, maskVal);
+# endif
         psSparseVectorElement (sparse, i, f);
 
@@ -329,11 +372,22 @@
         switch (SKY_FIT_ORDER) {
           case 1:
+# if (HAVE_MODEL_VAR)
             f = pmSourceModelWeight (SRCi, 1, fitVarMode, covarFactor, maskVal);
             psSparseBorderElementB (border, i, 1, f);
             f = pmSourceModelWeight (SRCi, 2, fitVarMode, covarFactor, maskVal);
             psSparseBorderElementB (border, i, 2, f);
+# else
+            f = pmSourceModelWeight (SRCi, 1, CONSTANT_PHOTOMETRIC_WEIGHTS, covarFactor, maskVal);
+            psSparseBorderElementB (border, i, 1, f);
+            f = pmSourceModelWeight (SRCi, 2, CONSTANT_PHOTOMETRIC_WEIGHTS, covarFactor, maskVal);
+            psSparseBorderElementB (border, i, 2, f);
+# endif
 
           case 0:
+# if (HAVE_MODEL_VAR)
             f = pmSourceModelWeight (SRCi, 0, fitVarMode, covarFactor, maskVal);
+# else
+            f = pmSourceModelWeight (SRCi, 0, CONSTANT_PHOTOMETRIC_WEIGHTS, covarFactor, maskVal);
+# endif
             psSparseBorderElementB (border, i, 0, f);
             break;
@@ -355,5 +409,9 @@
 
             // got an overlap; calculate cross-product and add to output array
+# if (HAVE_MODEL_VAR)
             f = pmSourceModelDotModel (SRCi, SRCj, fitVarMode, covarFactor, maskVal);
+# else
+            f = pmSourceModelDotModel (SRCi, SRCj, CONSTANT_PHOTOMETRIC_WEIGHTS, covarFactor, maskVal);
+# endif
             psSparseMatrixElement (sparse, j, i, f);
         }
@@ -393,5 +451,9 @@
 
     // set the sky, sky_x, sky_y components of border matrix
+# if (HAVE_MODEL_VAR)
     SetBorderMatrixElements (border, readout, fitSources, (fitVarMode == PM_SOURCE_PHOTFIT_CONST), SKY_FIT_ORDER, markVal);
+# else
+    SetBorderMatrixElements (border, readout, fitSources, CONSTANT_PHOTOMETRIC_WEIGHTS, SKY_FIT_ORDER, markVal);
+# endif
 
     psSparseConstraint constraint;
@@ -552,4 +614,5 @@
 }
 
+# if (HAVE_MODEL_VAR)
 bool psphotModelBackgroundReadout(psImage *model,  // Model image
 				  psImage *modelStdev, // Model stdev image
@@ -661,2 +724,3 @@
     return true;
 }
+# endif
Index: branches/eam_branches/ipp-20120601/psphot/src/psphotReplaceUnfit.c
===================================================================
--- branches/eam_branches/ipp-20120601/psphot/src/psphotReplaceUnfit.c	(revision 34048)
+++ branches/eam_branches/ipp-20120601/psphot/src/psphotReplaceUnfit.c	(revision 34049)
@@ -60,5 +60,6 @@
 
     psArray *sources = detections->allSources;
-    psAssert (sources, "missing sources?");
+    //psAssert (sources, "missing sources?");
+    if (!sources) return true;
 
     // user-defined masks to test for good/bad pixels (build from recipe list if not yet set)
@@ -139,6 +140,7 @@
 
     psArray *sources = detections->allSources;
-    psAssert (sources, "missing sources?");
-
+    //psAssert (sources, "missing sources?");
+    if (!sources) return true;
+    
     // user-defined masks to test for good/bad pixels (build from recipe list if not yet set)
     psImageMaskType maskVal = psMetadataLookupImageMask(&status, recipe, "MASK.PSPHOT"); // Mask value for bad pixels
Index: branches/eam_branches/ipp-20120601/tools/regpeek.pl
===================================================================
--- branches/eam_branches/ipp-20120601/tools/regpeek.pl	(revision 34048)
+++ branches/eam_branches/ipp-20120601/tools/regpeek.pl	(revision 34049)
@@ -3,4 +3,8 @@
 use DBI;
 use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt );
+use PS::IPP::Config 1.0.1 qw( :standard );
+
+my $ipprc =  PS::IPP::Config->new(); # IPP Configuration
+my $siteConfig = $ipprc->{_siteConfig};
 
 my $dbname = 'gpc1';
@@ -65,12 +69,19 @@
 
 sub init_gpc_db {
+    ## change to use the siteConfig setting, while readonly probably do not want to use a readonly replicated DB incase it gets behind
     use constant DB_SOCKET => '/var/run/mysqld/mysqld.sock';
-    my $dbserver = 'ippdb01';
-    my $dbuser = 'ippuser';
-    my $dbpass = 'ippuser';
+    #my $dbserver = 'ippdb01';
+    #my $dbuser = 'ippuser';
+    #my $dbpass = 'ippuser';
+    my $dbserver = metadataLookupStr($siteConfig, 'DBSERVER');
+    my $dbuser = metadataLookupStr($ipprc->{_siteConfig}, "RO_DBUSER");
+    my $dbpass = metadataLookupStr($ipprc->{_siteConfig}, "RO_DBPASSWORD");
+    die "database configuration not set up" unless defined($dbserver);
+    die "database configuration not set up" unless defined($dbuser);
+    die "database configuration not set up" unless defined($dbpass);
     $db = DBI->connect("DBI:mysql:database=${dbname};host=${dbserver};" .
                        "mysql_socket=" . DB_SOCKET(),
                        ${dbuser},${dbpass},
-{ RaiseError => 1, AutoCommit => 1}
+		       { RaiseError => 1, AutoCommit => 1}
         ) or die "Unable to connect to database $DBI::errstr\n";
 return($db);
