Index: trunk/psModules/src/detrend/pmPattern.c
===================================================================
--- trunk/psModules/src/detrend/pmPattern.c	(revision 35081)
+++ trunk/psModules/src/detrend/pmPattern.c	(revision 35270)
@@ -997,6 +997,6 @@
       pmChip *chip = out->fpa->chips->data[i];
       pmCell *cell = chip->cells->data[0]; // Cell of interest
-      pmReadout *ro = cell->readouts->data[0]; // Readout of interest
-
+
+      
       psStatsInit(bgStats);
 
@@ -1009,5 +1009,12 @@
       int y = chipName[3] - '0';
 
-      
+      if ((cell->readouts->n != 1)||(!chip->data_exists))  {
+	A->data.F64[y][x] = NAN;
+	B->data.F64[y][x] = NAN;
+	C->data.F64[y][x] = NAN;
+	D->data.F64[y][x] = NAN;
+	continue;
+      }
+      pmReadout *ro = cell->readouts->data[0]; // Readout of interest      
       for (int j = 0; j < 4; j++) {
 	if (j == 0) {  // Region B
@@ -1284,4 +1291,7 @@
 	pmChip *chip = out->fpa->chips->data[i];
         pmCell *cell = chip->cells->data[0]; // Cell of interest
+	if ((cell->readouts->n != 1)||(!chip->data_exists))  {
+	  continue;
+	}
         pmReadout *ro = cell->readouts->data[0]; // Readout of interest
 	const char *chipName = psMetadataLookupStr(NULL,chip->concepts, "CHIP.NAME");
