Index: trunk/ppStats/src/ppStatsLoop.c
===================================================================
--- trunk/ppStats/src/ppStatsLoop.c	(revision 13676)
+++ trunk/ppStats/src/ppStatsLoop.c	(revision 13688)
@@ -114,8 +114,4 @@
     if (!data->doStats && psListLength(data->summary)) {
         // Nothing further to do --- don't want to waste our time reading the data
-        if (psListLength(cellResults->list) > 0) {
-            psMetadataAdd(chipResults, PS_LIST_TAIL, cellName, PS_DATA_METADATA,
-                          "Results for cell", cellResults);
-        }
         goto cellDone;
     }
@@ -152,5 +148,5 @@
     if (data->sample <= 0.0) {
         if (!psImageStats(data->stats, readout->image, readout->mask, data->maskVal)) {
-            psLogMsg(__func__, PS_LOG_WARN, "Unable to perform statistics on cell %s --- ignored.\n", cellName);
+            psWarning("Unable to perform statistics on cell %s --- ignored.\n", cellName);
             goto statsDone;
         }
@@ -210,5 +206,5 @@
 statsDone:
     // count saturated pixels
-    if (psListLength(data->summary) > 0)     {
+    if (psListLength(data->summary) > 0) {
         bool get_nSatPixels = false;
         bool get_fSatPixels = false;
@@ -316,17 +312,12 @@
         result = cellStats(chipResults, cell, fits, data, config);
         if (result != PS_EXIT_SUCCESS) {
-            psError (PS_ERR_IO, false, "trouble with cell stats for %d\n", view->cell);
-            if (fits) {
-                pmChipFreeData(chip);
-            }
-            psFree(chipResults);
-            return result;
+            psError(PS_ERR_UNKNOWN, false, "trouble with cell stats for %d\n", view->cell);
         }
         addToHierarchy(chipResults, fpaResults, chipName, "Results for chip");
-	psFree (chipResults);
+        psFree (chipResults);
         if (fits) {
             pmChipFreeData(chip);
         }
-        return PS_EXIT_SUCCESS;
+        return result;
     }
 
@@ -336,5 +327,5 @@
         result = cellStats(chipResults, cell, fits, data, config);
         if (result != PS_EXIT_SUCCESS) {
-            psError (PS_ERR_IO, false, "trouble with cell stats for %d\n", i);
+            psError(PS_ERR_UNKNOWN, false, "trouble with cell stats for %d\n", i);
             if (fits) {
                 pmChipFreeData(chip);
