Index: branches/eam_branches/ipp-20130904/psModules/src/objects/pmModel.c
===================================================================
--- branches/eam_branches/ipp-20130904/psModules/src/objects/pmModel.c	(revision 36311)
+++ branches/eam_branches/ipp-20130904/psModules/src/objects/pmModel.c	(revision 36314)
@@ -217,9 +217,11 @@
     // the options allow us to modify various aspects of the model
     if (mode & PM_MODEL_OP_NORM) {
+	// if we are including the sky, renormalizing should force use to normalized down the sky flux
+	params->data.F32[PM_PAR_SKY] /= params->data.F32[PM_PAR_I0];
         params->data.F32[PM_PAR_I0] = 1.0;
     }
     if (!(mode & PM_MODEL_OP_SKY)) {
         params->data.F32[PM_PAR_SKY] = 0.0;
-    }
+    } 
     if (mode & PM_MODEL_OP_CENTER) {
         params->data.F32[PM_PAR_XPOS] = image->col0 + 0.5*image->numCols;
Index: branches/eam_branches/ipp-20130904/psModules/src/objects/pmPCM_MinimizeChisq.c
===================================================================
--- branches/eam_branches/ipp-20130904/psModules/src/objects/pmPCM_MinimizeChisq.c	(revision 36311)
+++ branches/eam_branches/ipp-20130904/psModules/src/objects/pmPCM_MinimizeChisq.c	(revision 36314)
@@ -135,5 +135,5 @@
 	}
 
-	if (1) {
+	if (0) {
 	    fprintf (stderr, "%d : ", min->iter);
 	    for (int ti = 0; ti < params->n; ti++) {
Index: branches/eam_branches/ipp-20130904/psModules/src/objects/pmPCMdata.c
===================================================================
--- branches/eam_branches/ipp-20130904/psModules/src/objects/pmPCMdata.c	(revision 36311)
+++ branches/eam_branches/ipp-20130904/psModules/src/objects/pmPCMdata.c	(revision 36314)
@@ -597,5 +597,6 @@
 
     // modelFlux always has unity normalization (I0 = 1.0)
-    pmModelAdd (source->modelFlux, source->maskObj, model, PM_MODEL_OP_FULL | PM_MODEL_OP_NORM, maskVal);
+    // pmModelAdd (source->modelFlux, source->maskObj, model, PM_MODEL_OP_FULL | PM_MODEL_OP_NORM, maskVal);
+    pmModelAdd (source->modelFlux, NULL, model, PM_MODEL_OP_FULL | PM_MODEL_OP_SKY | PM_MODEL_OP_NORM, maskVal);
 
     // convolve the model image with the PSF
Index: branches/eam_branches/ipp-20130904/psModules/src/objects/pmSourceFitPCM.c
===================================================================
--- branches/eam_branches/ipp-20130904/psModules/src/objects/pmSourceFitPCM.c	(revision 36311)
+++ branches/eam_branches/ipp-20130904/psModules/src/objects/pmSourceFitPCM.c	(revision 36314)
@@ -51,4 +51,6 @@
 # define TIMING 0
 
+bool pmSourceChisqModelFlux (pmSource *source, pmModel *model, psImageMaskType maskVal);
+
 bool pmSourceFitPCM (pmPCMdata *pcm, pmSource *source, pmSourceFitOptions *fitOptions, psImageMaskType maskVal, psImageMaskType markVal, int psfSize) {
     
@@ -113,5 +115,6 @@
     } else {
 	// xxx this is wrong because it does not convolve with the psf
-	pmSourceChisqUnsubtracted (source, pcm->modelConv, maskVal);
+	pmPCMMakeModel (source, pcm->modelConv, maskVal, psfSize);
+	pmSourceChisqModelFlux (source, pcm->modelConv, maskVal);
     }
     if (TIMING) { t4 = psTimerMark ("pmSourceFitPCM"); }
Index: branches/eam_branches/ipp-20130904/psModules/src/objects/pmSourcePhotometry.c
===================================================================
--- branches/eam_branches/ipp-20130904/psModules/src/objects/pmSourcePhotometry.c	(revision 36311)
+++ branches/eam_branches/ipp-20130904/psModules/src/objects/pmSourcePhotometry.c	(revision 36314)
@@ -902,4 +902,40 @@
 }
 
+bool pmSourceChisqModelFlux (pmSource *source, pmModel *model, psImageMaskType maskVal)
+{
+    PS_ASSERT_PTR_NON_NULL(source, false);
+    PS_ASSERT_PTR_NON_NULL(model, false);
+
+    float dC = 0.0;
+    int Npix = 0;
+
+    psVector *params = model->params;
+    psImage  *image = source->pixels;
+    psImage  *modelFlux = source->modelFlux;
+    psImage  *mask = source->maskObj;
+    psImage  *variance = source->variance;
+
+    float Io = params->data.F32[PM_PAR_I0];
+
+    for (int iy = 0; iy < image->numRows; iy++) {
+        for (int ix = 0; ix < image->numCols; ix++) {
+
+	    // skip pixels which are masked
+            if (mask->data.PS_TYPE_IMAGE_MASK_DATA[iy][ix] & maskVal) continue;
+
+            if (variance->data.F32[iy][ix] <= 0) continue;
+
+            dC += PS_SQR (image->data.F32[iy][ix] - Io*modelFlux->data.F32[iy][ix]) / variance->data.F32[iy][ix];
+            Npix ++;
+        }
+    }
+    model->nPix = Npix;
+    model->nDOF = Npix - model->nPar;
+    model->chisq = dC;
+    model->chisqNorm = dC / model->nDOF;
+
+    return (true);
+}
+
 double pmSourceModelWeight(const pmSource *Mi, int term, const pmSourceFitVarMode fitVarMode, const float covarFactor, psImageMaskType maskVal)
 {
