Index: /trunk/ppImage/src/ppImageLoop.c
===================================================================
--- /trunk/ppImage/src/ppImageLoop.c	(revision 10163)
+++ /trunk/ppImage/src/ppImageLoop.c	(revision 10164)
@@ -93,5 +93,11 @@
             // Perform statistics on the detrended cell
             if (stats) {
-                ppStats(stats, input->fpa, view, config);
+                bool mdok;              // Status of MD lookup
+                pmFPAfile *output = psMetadataLookupPtr(&mdok, config->files, "PPIMAGE.OUTPUT");
+                if (!mdok || !output) {
+                    psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find file PPIMAGE.OUTPUT.\n");
+                    return false;
+                }
+                ppStats(stats, output->fpa, view, config);
             }
 
