Index: trunk/psphot/src/psphotStackUpdateReadout.c
===================================================================
--- trunk/psphot/src/psphotStackUpdateReadout.c	(revision 38531)
+++ 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;
             }
