Index: trunk/magic/remove/src/streaksio.c
===================================================================
--- trunk/magic/remove/src/streaksio.c	(revision 26408)
+++ trunk/magic/remove/src/streaksio.c	(revision 26438)
@@ -121,4 +121,14 @@
     sf->transparentStreaks = psMetadataLookupF64(&status, config->arguments, "TRANSPARENT_STREAKS");
 
+    sf->stats = psMetadataAlloc();
+    psString statsFileName= psMetadataLookupStr(&status, config->arguments, "STATS");
+    if (statsFileName) {
+        sf->statsFile = fopen(statsFileName, "w");
+        if (!sf->statsFile) {
+            psError(PS_ERR_IO, true, "failed to open stats file %s", statsFileName);
+            streaksExit("", PS_EXIT_CONFIG_ERROR);
+        }
+    }
+
     return sf;
 }
@@ -128,5 +138,5 @@
 {
     freeImages(sf);
-    psFree(sf->warpedPixels);
+    psFree(sf->diffedPixels);
     psFree(sf->tiles);
     psFree(sf->view);
@@ -1181,4 +1191,7 @@
 }
 
+// Get the mask values that we need.
+// If an input mask file is provided get them from there.
+// Otherwise get them from the recipe MASKS
 void
 strkGetMaskValues(streakFiles *sfiles)
