Index: /branches/eam_branches/ipp-20110710/psphot/src/psphotBlendFit.c
===================================================================
--- /branches/eam_branches/ipp-20110710/psphot/src/psphotBlendFit.c	(revision 32241)
+++ /branches/eam_branches/ipp-20110710/psphot/src/psphotBlendFit.c	(revision 32242)
@@ -186,5 +186,5 @@
     psFree (fitOptions);
 
-    psLogMsg ("psphot.psphotBlendFit", PS_LOG_INFO, "fit models: %f sec for %d objects (%d psf, %d ext, %d failed, %ld skipped)\n", psTimerMark ("psphot.fit.nonlinear"), Nfit, Npsf, Next, Nfail, sources->n - Nfit);
+    psLogMsg ("psphot.psphotBlendFit", PS_LOG_WARN, "fit models: %f sec for %d objects (%d psf, %d ext, %d failed, %ld skipped)\n", psTimerMark ("psphot.fit.nonlinear"), Nfit, Npsf, Next, Nfail, sources->n - Nfit);
 
     psphotVisualShowResidualImage (readout, false);
@@ -233,4 +233,14 @@
         pmSource *source = sources->data[i];
 
+# define TEST_X -420.0
+# define TEST_Y 300.0
+   
+	if ((fabs(source->peak->xf - TEST_X) < 5) && (fabs(source->peak->yf - TEST_Y) < 5)) {
+	    fprintf (stderr, "test galaxy\n");
+	}
+
+# undef TEST_X
+# undef TEST_Y
+
         // skip non-astronomical objects (very likely defects)
         if (source->mode &  PM_SOURCE_MODE_BLEND) continue;
@@ -246,6 +256,9 @@
 
         // limit selection to some SN limit
-        if (sqrt(source->peak->detValue) < FIT_SN_LIM) continue;
-
+        if (source->mode & PM_SOURCE_MODE_EXT_LIMIT) {
+	    if (source->moments->KronFlux < FIT_SN_LIM * source->moments->KronFluxErr) continue;
+	} else {
+	    if (sqrt(source->peak->detValue) < FIT_SN_LIM) continue;
+	}
         // exclude sources outside optional analysis region
         if (source->peak->xf < AnalysisRegion.x0) continue;
@@ -267,5 +280,5 @@
         }
 
-        // replace object in image
+        // replace object in image & remove excess noise
         if (source->tmpFlags & PM_SOURCE_TMPF_SUBTRACTED) {
             pmSourceAdd (source, PM_MODEL_OP_FULL, maskVal);
@@ -305,5 +318,5 @@
         Nfail ++;
 
-        // re-subtract the object, leave local sky
+        // re-subtract the object, leave local sky, re-bump noise
         pmSourceCacheModel (source, maskVal);
         pmSourceSub (source, PM_MODEL_OP_FULL, maskVal);
