Index: trunk/ppStack/src/ppStackMatch.c
===================================================================
--- trunk/ppStack/src/ppStackMatch.c	(revision 17263)
+++ trunk/ppStack/src/ppStackMatch.c	(revision 17267)
@@ -13,5 +13,5 @@
 
 //#define TESTING
-//#define NO_CONVOLUTION
+#define NO_CONVOLUTION
 
 bool ppStackMatch(pmReadout *readout, psArray **regions, psArray **kernels,
@@ -36,14 +36,4 @@
     psStatsOptions renormStdev = psMetadataLookupS32(&mdok, config->arguments, "RENORM.STDEV"); // Statistic for stdev
     int renormWidth = psMetadataLookupS32(&mdok, config->arguments, "RENORM.WIDTH"); // Width for renormalisation box
-
-    // Renormalise the variances if desired
-    if (renorm) {
-        psLogMsg("ppMerge", PS_LOG_INFO, "Renormalising variance map.");
-        if (!pmReadoutWeightRenorm(readout, maskBad, renormMean, renormStdev, renormWidth, rng)) {
-            psError(PS_ERR_UNKNOWN, false, "Unable to renormalise variances.");
-            psFree(output);
-            return false;
-        }
-    }
 
 #ifndef NO_CONVOLUTION
@@ -190,13 +180,26 @@
     assert((*regions)->n == (*kernels)->n);
 
+    // Renormalise the variances if desired
+    if (renorm) {
+        psLogMsg("ppMerge", PS_LOG_INFO, "Renormalising variance map.");
+        if (!pmReadoutWeightRenorm(readout, maskBad, renormMean, renormStdev, renormWidth, rng)) {
+            psError(PS_ERR_UNKNOWN, false, "Unable to renormalise variances.");
+            psFree(output);
+            return false;
+        }
+    }
+
     // Ensure the background value is zero
-    psStats *bg = psStatsAlloc(PS_STAT_ROBUST_MEDIAN); // Statistics for background
+    psStats *bg = psStatsAlloc(PS_STAT_ROBUST_MEDIAN | PS_STAT_ROBUST_STDEV); // Statistics for background
     if (!psImageBackground(bg, NULL, readout->image, readout->mask, maskBad, rng)) {
         psWarning("Can't measure background for image.");
         psErrorClear();
     } else {
+        psLogMsg("ppStack", PS_LOG_INFO, "Correcting convolved image background by %lf (+/- %lf)",
+                 psStatsGetValue(bg, PS_STAT_ROBUST_MEDIAN), psStatsGetValue(bg, PS_STAT_ROBUST_STDEV));
         (void)psBinaryOp(readout->image, readout->image, "+",
                          psScalarAlloc(- psStatsGetValue(bg, PS_STAT_ROBUST_MEDIAN), PS_TYPE_F32));
     }
+    psFree(bg);
 
     psFree(output);
