Index: branches/tap_branches/ppImage/src/ppImageLoop.c
===================================================================
--- branches/tap_branches/ppImage/src/ppImageLoop.c	(revision 25900)
+++ branches/tap_branches/ppImage/src/ppImageLoop.c	(revision 27838)
@@ -8,4 +8,5 @@
   psError(PS_ERR_UNKNOWN, false, MESSAGE); \
   psFree(view); \
+  pmFPAfileFreeSetStrict(false); \
   return false; \
 }
@@ -100,5 +101,5 @@
 
                 // flip the image to match the native detector orientation (to match bias, flat, etc)
-		if (!ppImageParityFlip(config, options, view, true)) {
+                if (!ppImageParityFlip(config, options, view, true)) {
                     ESCAPE("Unable to detrend readout");
                 }
@@ -131,5 +132,5 @@
 
             // process each of the readouts
-	    // XXX reset the view to the first readout?
+            // XXX reset the view to the first readout?
             while ((readout = pmFPAviewNextReadout (view, input->fpa, 1)) != NULL) {
                 if (!readout->data_exists) {
@@ -140,5 +141,5 @@
                     ESCAPE("Unable to detrend readout");
                 }
-	    }
+            }
 
             // free detrend images potentially in use: MASK, BIAS, DARK, SHUTTER, FLAT
@@ -161,4 +162,11 @@
         if (!ppImageFringeFree (config, view)) {
             ESCAPE("Unable to free fringe images");
+        }
+
+        // Apply the pattern correction
+        if (options->doPatternRow || options->doPatternCell) {
+          if (!ppImageDetrendPatternApply(config,chip,view,options)) {
+            ESCAPE("Unable to apply pattern corrections");
+          }
         }
 
