Index: branches/eam_branches/stackphot.20100406/ppSim/src/ppSimInsertGalaxies.c
===================================================================
--- branches/eam_branches/stackphot.20100406/ppSim/src/ppSimInsertGalaxies.c	(revision 27630)
+++ branches/eam_branches/stackphot.20100406/ppSim/src/ppSimInsertGalaxies.c	(revision 27647)
@@ -74,13 +74,13 @@
     int dY = PM_CELL_TO_CHIP (0.0, y0Cell, yParityCell, binning);
 
-    pmDetections *detections = psMetadataLookupPtr (readout->analysis, "PSPHOT.DETECTIONS", 0);
+    pmDetections *detections = psMetadataLookupPtr (&mdok, readout->analysis, "PSPHOT.DETECTIONS");
     if (!detections) {
 	detections = pmDetectionsAlloc();
-	detection->allSources = psArrayAllocEmpty (galaxies->n);
+	detections->allSources = psArrayAllocEmpty (galaxies->n);
 	psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSPHOT.DETECTIONS", PS_DATA_ARRAY | PS_META_REPLACE, "psphot detections", detections);
     } else {
 	psMemIncrRefCounter (detections);
     }
-    psArray *sources = sources = detection->allSources;
+    psArray *sources = sources = detections->allSources;
 
     // add sources to the readout image & weight
Index: branches/eam_branches/stackphot.20100406/ppSim/src/ppSimInsertStars.c
===================================================================
--- branches/eam_branches/stackphot.20100406/ppSim/src/ppSimInsertStars.c	(revision 27630)
+++ branches/eam_branches/stackphot.20100406/ppSim/src/ppSimInsertStars.c	(revision 27647)
@@ -146,5 +146,5 @@
 
     pmDetections *detections = pmDetectionsAlloc();
-    detection->allSources = sources;
+    detections->allSources = sources;
 
     // save detections on the readout->analysis
Index: branches/eam_branches/stackphot.20100406/ppSim/src/ppSimUtils.c
===================================================================
--- branches/eam_branches/stackphot.20100406/ppSim/src/ppSimUtils.c	(revision 27630)
+++ branches/eam_branches/stackphot.20100406/ppSim/src/ppSimUtils.c	(revision 27647)
@@ -270,4 +270,6 @@
 psArray *ppSimSelectSources (pmConfig *config, const pmFPAview *view, const char *filename) {
 
+    bool status;
+
     pmReadout *readout = pmFPAfileThisReadout (config->files, view, filename);
     PS_ASSERT_PTR_NON_NULL (readout, NULL);
