Index: /trunk/psphot/src/psphotDeblendSatstars.c
===================================================================
--- /trunk/psphot/src/psphotDeblendSatstars.c	(revision 38559)
+++ /trunk/psphot/src/psphotDeblendSatstars.c	(revision 38560)
@@ -136,4 +136,5 @@
         source = sources->data[N];
 
+        if (!source->pixels) continue;
 #ifndef DEBLEND_PASS2_SOURCES
         // XXX: Need to define this if we want to rerun the satstar stuff again on the pass2 sources
Index: /trunk/psphot/src/psphotMergeSources.c
===================================================================
--- /trunk/psphot/src/psphotMergeSources.c	(revision 38559)
+++ /trunk/psphot/src/psphotMergeSources.c	(revision 38560)
@@ -1013,5 +1013,7 @@
                         } else {
                             // What to do here? 
-                            psAssert (pcm, "pmPCMinit failed!");
+                            // psAssert (pcm, "pmPCMinit failed!");
+                            psFree (sourceOut->modelEXT);
+                            sourceOut->modelEXT = NULL;
                         }
                     } else {
Index: /trunk/psphot/src/psphotReplaceUnfit.c
===================================================================
--- /trunk/psphot/src/psphotReplaceUnfit.c	(revision 38559)
+++ /trunk/psphot/src/psphotReplaceUnfit.c	(revision 38560)
@@ -378,31 +378,11 @@
 
 	if (model->isPCM) {
-#if 0
-	    psAssert(false, "this section is not complete");
-
-	    pmSourceCachePSF (source, maskVal);
-
-	    psKernel *psfKernel = pmPCMkernelFromPSF(source, psfSize);
-	    if (!psfKernel) { 
-		psWarning ("no psf kernel");
-	    }
-
-	    // generate an image of the right size
-	    psImage *rawModelFlux = psImageCopy (NULL, source->pixels, PS_TYPE_F32);
-	    psImageInit (rawModelFlux, 0.0);
-	  
-	    // insert the model image normalized to 1.0
-	    pmModelAdd (rawModelFlux, NULL, model, PM_MODEL_OP_FULL | PM_MODEL_OP_NORM, maskVal);
-
-	    psImageConvolveFFT (source->modelFlux, rawModelFlux, NULL, 0, psfKernel);
-	    psFree (psfKernel);
-	    psFree (rawModelFlux);
-#endif
-           pmPCMdata *pcm = pmPCMinit (source, fitOptions, model, maskVal, psfSize);
+            pmPCMdata *pcm = pmPCMinit (source, fitOptions, model, maskVal, psfSize);
             if (pcm) {
                 pmPCMCacheModel (source, maskVal, psfSize, pcm->nsigma);
                 psFree(pcm);
             } else {
-                psAssert (pcm, "pmPCMinit failed!");
+                psFree(source->modelEXT);
+                source->modelEXT = NULL;
             }
 	  
Index: /trunk/psphot/src/psphotStackUpdateReadout.c
===================================================================
--- /trunk/psphot/src/psphotStackUpdateReadout.c	(revision 38559)
+++ /trunk/psphot/src/psphotStackUpdateReadout.c	(revision 38560)
@@ -362,4 +362,5 @@
             source->modelPSF->residuals = psf->residuals;
         }
+
         if (!(source->mode & PM_SOURCE_MODE_PSFMODEL)) {
             // The cmf loaders unconditionallly create psf models even if the source did not have one.
@@ -372,14 +373,16 @@
         }
 
-        // make sure that the window radius is large enough. Should we do this regardless of whether
-        // or not the source is extended?
+        // make sure that the window radius is large enough.
+        // Should we do this regardless of whether or not the source is extended?
         float fitRadius = NAN;
         float windowRadius = NAN;
-        if (1 || source->modelEXT) {
-            if (!psphotSetRadiusMoments (&fitRadius, &windowRadius, readout, source, markVal)) {
-                psError (PSPHOT_ERR_UNKNOWN, false, "failed to set radius for ext source");
-                return false;
-            }
-        }
+        if (!psphotSetRadiusMoments (&fitRadius, &windowRadius, readout, source, markVal)) {
+            psError (PSPHOT_ERR_UNKNOWN, false, "failed to set radius for ext source");
+            return false;
+        }
+        // We are getting some sources near the edge of skycells which are marked as having
+        // been fit with saturated star model but have peak coordinates far outside the
+        // image. When this happens an error is left on the stack.
+        psErrorClear();
         
         // If we find a good model we will cache it below.
@@ -431,21 +434,21 @@
                 // I Should be getting that information from the recipe.
                 pmPCMdata *pcm = pmPCMinit (source, fitOptions, model, maskVal, psfSize);
-                if (!pcm) {
-                    psError (PSPHOT_ERR_UNKNOWN, false, "failed to to initialize PCM for model");
-                    return false;
+                if (pcm) {
+                    model->params->data.F32[PM_PAR_I0] = 1.0;
+                    float normFlux = model->class->modelFlux(model->params);
+                    float I0 = modelFlux / normFlux;
+                    if (isfinite(I0)) {
+                        model->params->data.F32[PM_PAR_I0] = I0;
+                        goodModel = true;
+                        // Usually this it is set when doing the fit. Since we are instantiating the model we
+                        // set it explicitly here. 
+                        model->isPCM = true;
+                    }
+                    psFree(pcm);
+                } else {
+                    // psError (PSPHOT_ERR_UNKNOWN, false, "failed to to initialize PCM for model");
+                    // return false;
+                    // fall through
                 }
-                model->params->data.F32[PM_PAR_I0] = 1.0;
-                // XXX: this duplicates work that pmPCMCacheModel does
-                // pmPCMMakeModel (source, model, pcm->nsigma, maskVal, psfSize);
-                float normFlux = model->class->modelFlux(model->params);
-                float I0 = modelFlux / normFlux;
-                if (isfinite(I0)) {
-                    model->params->data.F32[PM_PAR_I0] = I0;
-                    goodModel = true;
-                    // Usually this it is set when doing the fit. Since we are instantiating the model we
-                    // set it explicitly here. 
-                    model->isPCM = true;
-                }
-                psFree(pcm);
             }
             if (!goodModel) {
@@ -458,4 +461,6 @@
                 // XXX However we aren't going to cache it below so...
                 source->type = PM_SOURCE_TYPE_STAR;
+                psFree(source->modelEXT);
+                source->modelEXT = NULL;
                 model = NULL;
             }
