Index: trunk/ppStack/src/ppStackMatch.c
===================================================================
--- trunk/ppStack/src/ppStackMatch.c	(revision 17262)
+++ trunk/ppStack/src/ppStackMatch.c	(revision 17263)
@@ -190,4 +190,13 @@
     assert((*regions)->n == (*kernels)->n);
 
+    // Ensure the background value is zero
+    psStats *bg = psStatsAlloc(PS_STAT_ROBUST_MEDIAN); // Statistics for background
+    if (!psImageBackground(bg, NULL, readout->image, readout->mask, maskBad, rng)) {
+        psWarning("Can't measure background for image.");
+        psErrorClear();
+    } else {
+        (void)psBinaryOp(readout->image, readout->image, "+",
+                         psScalarAlloc(- psStatsGetValue(bg, PS_STAT_ROBUST_MEDIAN), PS_TYPE_F32));
+    }
 
     psFree(output);
