Index: trunk/ppMerge/src/ppMergeMask.c
===================================================================
--- trunk/ppMerge/src/ppMergeMask.c	(revision 24114)
+++ trunk/ppMerge/src/ppMergeMask.c	(revision 39500)
@@ -110,4 +110,7 @@
                 pmHDU *hdu = pmHDUGetHighest(outCell->parent->parent, outCell->parent, outCell); // File HDU
                 if (hdu && hdu != *lastHDU) {
+                    if (!hdu->header) {
+                        hdu->header = psMetadataAlloc();
+                    }
                     ppMergeVersionHeader(hdu->header);
                     *lastHDU = hdu;
@@ -285,5 +288,6 @@
         if (!outCell->process) continue;
 
-        pmHDU *hdu = pmHDUFromCell(outCell); ///< HDU for cell
+        // pmHDU *hdu = pmHDUFromCell(outCell); ///< HDU for cell
+	pmHDU *hdu = pmHDUGetLowest(outFPA, outChip, outCell); ///< HDU for cell
         if (!hdu || hdu->blankPHU) continue;
 
@@ -307,7 +311,9 @@
 
         // Supplementary outputs
+	pmCell *countsCell = NULL;
+	pmCell *sigmaCell = NULL;
         {
             // The counts image is fairly useless, but it preserves the model
-            pmCell *countsCell = pmFPAfileThisCell(config->files, outView, "PPMERGE.OUTPUT.COUNT");
+            countsCell = pmFPAfileThisCell(config->files, outView, "PPMERGE.OUTPUT.COUNT");
             pmReadout *countsRO = pmReadoutAlloc(countsCell); ///< Readout with count of inputs per pixel
             countsRO->image = psImageAlloc(outRO->mask->numCols, outRO->mask->numRows, PS_TYPE_F32);
@@ -316,5 +322,5 @@
             psFree(countsRO);
 
-            pmCell *sigmaCell = pmFPAfileThisCell(config->files, outView, "PPMERGE.OUTPUT.SIGMA");
+            sigmaCell = pmFPAfileThisCell(config->files, outView, "PPMERGE.OUTPUT.SIGMA");
             pmReadout *sigmaRO = pmReadoutAlloc(sigmaCell); ///< Readout with suspect image
             psImage *suspect = psMetadataLookupPtr(NULL, outRO->analysis, PM_MASK_ANALYSIS_SUSPECT);
@@ -323,4 +329,5 @@
             sigmaRO->data_exists = sigmaCell->data_exists = sigmaCell->parent->data_exists = true;
             psFree(sigmaRO);
+
         }
 
@@ -354,4 +361,16 @@
             }
             psFree(cells);
+
+	    // XXX EAM 2016.03.29 : sigmaCell and countsCell need to have their concepts copied from outCell.
+	    // This was causing segfaults for VYSOS5; Why did this ever work for SIMTEST?
+	    if (!pmConceptsCopyCell(countsCell, outCell)) {
+	      psError(PS_ERR_UNKNOWN, false, "Unable to copy cell concepts.");
+	      goto MERGE_MASK_ERROR;
+	    }
+
+	    if (!pmConceptsCopyCell(sigmaCell, outCell)) {
+	      psError(PS_ERR_UNKNOWN, false, "Unable to copy cell concepts.");
+	      goto MERGE_MASK_ERROR;
+	    }
 
             // Statistics on the merged cell using a fake image
