Index: trunk/psphot/src/psphotBlendFit.c
===================================================================
--- trunk/psphot/src/psphotBlendFit.c	(revision 30624)
+++ trunk/psphot/src/psphotBlendFit.c	(revision 31154)
@@ -94,4 +94,5 @@
     fitOptions->weight        = PS_SQR(skySig);
     fitOptions->mode          = PM_SOURCE_FIT_PSF;
+    fitOptions->covarFactor   = psImageCovarianceFactorForAperture(readout->covariance, 10.0); // Covariance matrix
 
     psphotInitLimitsPSF (recipe, readout);
@@ -103,5 +104,5 @@
 
     // source analysis is done in S/N order (brightest first)
-    sources = psArraySort (sources, pmSourceSortBySN);
+    sources = psArraySort (sources, pmSourceSortByFlux);
     if (!sources->n) {
         psLogMsg ("psphot", PS_LOG_INFO, "no sources, skipping blend");
@@ -176,5 +177,5 @@
             }
             psFree(job);
-            }
+	}
     }
     psFree (cellGroups);
@@ -242,5 +243,5 @@
 
         // limit selection to some SN limit
-        if (source->peak->SN < FIT_SN_LIM) continue;
+        if (sqrt(source->peak->detValue) < FIT_SN_LIM) continue;
 
         // exclude sources outside optional analysis region
