Index: /trunk/psphot/src/psphotKronIterate.c
===================================================================
--- /trunk/psphot/src/psphotKronIterate.c	(revision 34310)
+++ /trunk/psphot/src/psphotKronIterate.c	(revision 34311)
@@ -160,4 +160,5 @@
 
     // generate the window image: multiply the flux by this to downweight neighbors
+    // XXX: we don't need this image if we aren't going to apply the window
     psImage *kronWindow = psImageAlloc (readout->image->numCols, readout->image->numRows, PS_TYPE_F32);
     psImageInit (kronWindow, 1.0);
@@ -329,18 +330,15 @@
             } else {
                 if (KRON_SB_MIN_DIVISOR) {
-                    if (isfinite(source->moments->KronFlux) && (source->moments->KronFlux > 0)) {
-                        // Limit window radius based on surface brightness
+                    // Limit window radius based on surface brightness if we have a good measurement of kron flux
+                    if (isfinite(source->moments->Mrf) && source->moments->Mrf > 0 && 
+                        isfinite(source->moments->KronFlux)  && (source->moments->KronFlux > 0)) {
                         float Rmax = sqrt(source->moments->KronFlux) / KRON_SB_MIN_DIVISOR;
 
-                        if (source->moments->Mrf > 0) {
-                            maxWindow = PS_MIN(6.0*source->moments->Mrf, Rmax);
-                        } else {
-                            maxWindow = Rmax;
-                        }
+                        maxWindow = PS_MIN(6.0*source->moments->Mrf, Rmax);
                     } else {
                         maxWindow = RADIUS;
                     }
                 } else {
-                    // old code
+                    // old recipe, no surface brightness cut
                     maxWindow = isfinite(source->moments->Mrf) ? 6.0*source->moments->Mrf : RADIUS;
                 }
@@ -491,6 +489,13 @@
     }
 
+    float MrfTry = RF/RS;
+    if (!isfinite(MrfTry)) {
+        // We did not get a successul measurement of the kron radius. 
+        // Leave the current values unchanged.
+        return false;
+    }
+
+    float Mrf = MAX(minKronRadius, MrfTry);
     // Saturate the 1st radial moment
-    float Mrf = MAX(minKronRadius, RF/RS);
     if (sqrt(source->peak->detValue) < 10.0) {
 	Mrf = MIN (radius, Mrf);
@@ -559,4 +564,7 @@
     psAssert(kronWindow, "need a window");
 
+    // If we are not applying the window then we don't need to check for valid Mrf here.
+    // We should give the this module a chance to measure a good value. 
+    // Not yet though. We need to test the effect of this
     if (!isfinite(source->moments->Mrf) || source->moments->Mrf < 0 ) return false;
 
