Index: trunk/ppSim/src/ppSimLoadStars.c
===================================================================
--- trunk/ppSim/src/ppSimLoadStars.c	(revision 24807)
+++ trunk/ppSim/src/ppSimLoadStars.c	(revision 25760)
@@ -41,5 +41,5 @@
     psMetadataAdd(astroRecipe, PS_LIST_TAIL, "DEC_MIN", PS_DATA_F32 | PS_META_REPLACE, "", dec0 - radius);
     psMetadataAdd(astroRecipe, PS_LIST_TAIL, "DEC_MAX", PS_DATA_F32 | PS_META_REPLACE, "", dec0 + radius);
-    psArray *refStars = psastroLoadRefstars(config, "PSASTRO.INPUT");
+    psArray *refStars = psastroLoadRefstars(config, "PPSIM.OUTPUT");
     if (!refStars) {
         psError(PS_ERR_UNKNOWN, false, "Unable to find reference stars.");
Index: trunk/ppSim/src/ppSimLoop.c
===================================================================
--- trunk/ppSim/src/ppSimLoop.c	(revision 24807)
+++ trunk/ppSim/src/ppSimLoop.c	(revision 25760)
@@ -30,4 +30,9 @@
     ppSimType type = ppSimTypeFromString (typeStr); // Type of image to simulate
     int binning = psMetadataLookupS32(NULL, recipe, "BINNING"); // Binning in x and y
+
+    ppSimUpdateConceptsFPA (fpa, config);
+    if (fpa->hdu) { // XXX only do this if there is no INPUT image
+        if (!ppSimInitHeader(config, fpa, NULL, NULL)) ESCAPE (PS_ERR_UNKNOWN, "problem setting output header");
+    }
 
     psArray *stars = psArrayAllocEmpty (1);
@@ -57,9 +62,4 @@
         psFree(view);
         return false;
-    }
-
-    ppSimUpdateConceptsFPA (fpa, config);
-    if (fpa->hdu) { // XXX only do this if there is no INPUT image
-        if (!ppSimInitHeader(config, fpa, NULL, NULL)) ESCAPE (PS_ERR_UNKNOWN, "problem setting output header");
     }
 
Index: trunk/ppSim/src/ppSimMakeStars.c
===================================================================
--- trunk/ppSim/src/ppSimMakeStars.c	(revision 24807)
+++ trunk/ppSim/src/ppSimMakeStars.c	(revision 25760)
@@ -61,5 +61,5 @@
 	if (!status) {
 	    refMag = brightMag;
-	    refSum = 1;
+	    refSum = starsDensity * xSize * ySize * PS_SQR(scale * 180.0 / M_PI);
 	}
     } else {
