Index: trunk/ppMerge/src/ppMergeMaskAverageConcepts.c
===================================================================
--- trunk/ppMerge/src/ppMergeMaskAverageConcepts.c	(revision 15937)
+++ trunk/ppMerge/src/ppMergeMaskAverageConcepts.c	(revision 16989)
@@ -18,6 +18,6 @@
 // Generate a mask
 bool ppMergeMaskAverageConcepts(ppMergeData *data,  // Data
-				ppMergeOptions *options, // Options
-				pmConfig *config    // Configuration
+                                ppMergeOptions *options, // Options
+                                pmConfig *config    // Configuration
     )
 {
@@ -38,19 +38,24 @@
         while ((cellOut = pmFPAviewNextCell(view, fpaOut, 1))) {
 
+            pmHDU *hdu = pmHDUGetLowest(fpaOut, chipOut, cellOut);
+            if (!hdu || hdu->blankPHU) {
+                continue;
+            }
+
             // Get list of cells for concepts averaging
-	    psList *inCells = psListAlloc(NULL); // List of cells
-	    for (int i = 0; i < filenames->n; i++) {
-		if (! filenames->data[i] || strlen(filenames->data[i]) == 0) {
-		    continue;
-		}
-		pmCell *cellIn = pmFPAviewThisCell(view, data->in->data[i]); // Input cell
-		psListAdd(inCells, PS_LIST_TAIL, cellIn);
-	    }
-	    if (!pmConceptsAverageCells(cellOut, inCells, NULL, NULL, true)) {
-		psError(PS_ERR_UNKNOWN, false, "Unable to average cell concepts.");
-		psFree(inCells);
-		return false;
-	    }
-	    psFree(inCells);
+            psList *inCells = psListAlloc(NULL); // List of cells
+            for (int i = 0; i < filenames->n; i++) {
+                if (! filenames->data[i] || strlen(filenames->data[i]) == 0) {
+                    continue;
+                }
+                pmCell *cellIn = pmFPAviewThisCell(view, data->in->data[i]); // Input cell
+                psListAdd(inCells, PS_LIST_TAIL, cellIn);
+            }
+            if (!pmConceptsAverageCells(cellOut, inCells, NULL, NULL, true)) {
+                psError(PS_ERR_UNKNOWN, false, "Unable to average cell concepts.");
+                psFree(inCells);
+                return false;
+            }
+            psFree(inCells);
         }
     }
@@ -59,15 +64,15 @@
     psList *inFPAs = psListAlloc(NULL); // List of FPAs
     for (int i = 0; i < filenames->n; i++) {
-	if (! filenames->data[i] || strlen(filenames->data[i]) == 0) {
-	    continue;
-	}
-	pmFPA *fpaIn = data->in->data[i]; // Input FPA
-	psListAdd(inFPAs, PS_LIST_TAIL, fpaIn);
+        if (! filenames->data[i] || strlen(filenames->data[i]) == 0) {
+            continue;
+        }
+        pmFPA *fpaIn = data->in->data[i]; // Input FPA
+        psListAdd(inFPAs, PS_LIST_TAIL, fpaIn);
     }
 
     if (!pmConceptsAverageFPAs(fpaOut, inFPAs)) {
-	psError(PS_ERR_UNKNOWN, false, "Unable to average FPA concepts.");
-	psFree(inFPAs);
-	return false;
+        psError(PS_ERR_UNKNOWN, false, "Unable to average FPA concepts.");
+        psFree(inFPAs);
+        return false;
     }
     psFree(inFPAs);
