Index: trunk/ppViz/src/ppVizPSF/ppVizPSFCamera.c
===================================================================
--- trunk/ppViz/src/ppVizPSF/ppVizPSFCamera.c	(revision 34089)
+++ trunk/ppViz/src/ppVizPSF/ppVizPSFCamera.c	(revision 34800)
@@ -19,4 +19,5 @@
     files->data[0] = psStringCopy(name);
     if (psMetadataLookup(config->arguments, file)) {
+
         psMetadataRemoveKey(config->arguments, file);
     }
@@ -42,5 +43,6 @@
         fileArguments("SOURCES", data->sourcesName, "Input sources", data->config);
         pmFPAfile *srcs = pmFPAfileBindFromArgs(&status, psf, data->config,
-                                                "PSPHOT.INPUT.CMF", "SOURCES"); // File
+						"PSPHOT.INPUT.CMF", "SOURCES"); // File
+	fprintf(stderr,"%ld %d\n",(long) srcs, status);
         if (!status || !srcs) {
             psError(PS_ERR_IO, false, "Failed to build file from PSPHOT.INPUT.CMF");
Index: trunk/ppViz/src/ppVizPSF/ppVizPSFLoop.c
===================================================================
--- trunk/ppViz/src/ppVizPSF/ppVizPSFLoop.c	(revision 34089)
+++ trunk/ppViz/src/ppVizPSF/ppVizPSFLoop.c	(revision 34800)
@@ -20,5 +20,5 @@
         return NULL;
     }
-
+    fprintf(stderr,"Woo!\n");
     pmChip *chip;                       // Chip from FPA
     while ((chip = pmFPAviewNextChip(view, psfFile->fpa, 1))) {
@@ -56,15 +56,13 @@
                 psWarning("More than one readout present for chip %d, cell %d", view->chip, view->cell);
             }
-
+	    fprintf(stderr,"Woo!\n");
             pmReadout *readout;         // Readout from cell
             while ((readout = pmFPAviewNextReadout(view, psfFile->fpa, 1))) {
+	      fprintf(stderr,"Woo?\n");
                 if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) {
                     psError(PS_ERR_UNKNOWN, false, "Error loading data from files.");
                     return false;
                 }
-                if (!readout->data_exists) {
-                    continue;
-                }
-
+		fprintf(stderr,"Woo2?\n");
                 pmPSF *psf = psMetadataLookupPtr(NULL, chip->analysis, "PSPHOT.PSF");              // PSF
                 assert(psf);
@@ -72,4 +70,12 @@
                 bool mdok;              // Status of MD lookup
                 psArray *sources = psMetadataLookupPtr(&mdok, readout->analysis, "PSPHOT.SOURCES"); // Sources
+
+		if (sources && !readout->data_exists) {  // This fails if -sources not specified
+                    continue;
+                }
+		readout->data_exists = true;
+		fprintf(stderr,"Woo! %ld\n", sources ? sources->n : -1);
+
+		fprintf(stderr,"%d\n",mdok);
                 int numCols = 0, numRows = 0;              // Size of image
                 psVector *xOffset = NULL, *yOffset = NULL; // Offset from source to true position
@@ -80,5 +86,5 @@
                     psLogMsg("ppVizPSF", PS_LOG_INFO, "Generating %dx%d image", numCols, numRows);
                 }
-                if (sources) {
+                if (sources && !sources->n) {
                     psMemIncrRefCounter(sources);
                     psLogMsg("ppVizPSF", PS_LOG_INFO, "Using %ld input sources from CMF file", sources->n);
@@ -89,4 +95,5 @@
 
                 if (data->fakeNum > 0 && isfinite(data->fakeMag)) {
+		  fprintf(stderr,"Here! fakes\n");
                     long numOld = 0; // Old number of sources
                     long numNew = -1; // New number of sources
@@ -118,4 +125,5 @@
                 }
                 if (!sources && !data->input) {
+		  fprintf(stderr,"Here! default\n");
                     // Generate fake image with only a single realisation of the PSF
                     sources = psArrayAlloc(1);
@@ -151,6 +159,7 @@
                 psFree(psf->residuals);
                 psf->residuals = NULL;
-
+		fprintf(stderr,"still here");
                 if (sources) {
+		  fprintf(stderr,"Here! sources?\n");
                     if (!pmReadoutFakeFromSources(readout, numCols, numRows, sources, 0, xOffset, yOffset,
                                                   psf, data->minFlux, 0, false, true)) {
@@ -159,7 +168,9 @@
                     }
                 } else if (data->input) {
+
                     psVector *x = data->input->data[0]; // x coordinates
                     psVector *y = data->input->data[1]; // y coordinates
                     psVector *mag = data->input->data[2]; // Magnitudes
+		    fprintf(stderr,"Here! input? %d %d %g %d %ld\n",numCols,numRows,data->minFlux,1,x->n);
                     if (!pmReadoutFakeFromVectors(readout, numCols, numRows, x, y, mag, xOffset, yOffset,
                                                   psf, data->minFlux, 0, false, true)) {
@@ -168,5 +179,5 @@
                     }
                 }
-
+		
                 psFree(sources);
                 psFree(xOffset);
