Index: trunk/ppStack/src/ppStackMatch.c
===================================================================
--- trunk/ppStack/src/ppStackMatch.c	(revision 20098)
+++ trunk/ppStack/src/ppStackMatch.c	(revision 20426)
@@ -14,4 +14,5 @@
 #define SOURCE_MASK (PM_SOURCE_MODE_FAIL | PM_SOURCE_MODE_DEFECT | PM_SOURCE_MODE_SATURATED | \
                      PM_SOURCE_MODE_CR_LIMIT) // Mask to apply to input sources
+#define FAINT_SOURCE_FRAC 1.0e-4         // Set minimum flux to this fraction of faintest source flux
 
 //#define TESTING                         // Enable debugging output
@@ -178,4 +179,5 @@
             }
 
+            // Generate a fake image to match to
             float minFlux = INFINITY;       // Minimum flux for fake image
             {
@@ -190,16 +192,13 @@
             }
 
-            // Generate a fake image to match to
-            if (!isfinite(minFlux)) {
-                float maxMag = -INFINITY;   // Maximum magnitude of sources
-                for (int i = 0; i < sources->n; i++) {
-                    pmSource *source = sources->data[i]; // Source of interest
-                    if (source->psfMag > maxMag && source->psfMag <= MAG_IGNORE &&
-                        !(source->mode & SOURCE_MASK)) {
-                        maxMag = source->psfMag;
-                    }
+            float maxMag = -INFINITY;   // Maximum magnitude of sources
+            for (int i = 0; i < sources->n; i++) {
+                pmSource *source = sources->data[i]; // Source of interest
+                if (source->psfMag > maxMag && source->psfMag <= MAG_IGNORE &&
+                    !(source->mode & SOURCE_MASK)) {
+                    maxMag = source->psfMag;
                 }
-                minFlux = 0.01 * powf(10.0, -0.4 * maxMag);
-            }
+            }
+            minFlux = PS_MIN(FAINT_SOURCE_FRAC * powf(10.0, -0.4 * maxMag), minFlux);
 
             pmReadout *fake = pmReadoutAlloc(NULL); // Fake readout with target PSF
@@ -266,6 +265,4 @@
             readout->mask   = psMemIncrRefCounter(output->mask);
             readout->weight = psMemIncrRefCounter(output->weight);
-
-            readout->analysis = psMetadataCopy(readout->analysis, output->analysis);
         } else {
             // Fake the convolution
@@ -304,4 +301,6 @@
 #endif
 
+    readout->analysis = psMetadataCopy(readout->analysis, output->analysis);
+
 // Extract the regions and solutions used in the image matching
 // This stops them from being freed when we iterate back up the FPA
@@ -359,4 +358,5 @@
         float vf = psMetadataLookupF32(NULL, readout->parent->concepts, "CELL.VARFACTOR"); // Variance factor
         *chi2 /= vf * num;
+        psLogMsg("ppStack", PS_LOG_INFO, "Additional variance from chi^2: %f", *chi2);
     }
 
