Index: trunk/pstamp/scripts/pstamp_job_run.pl
===================================================================
--- trunk/pstamp/scripts/pstamp_job_run.pl	(revision 35487)
+++ trunk/pstamp/scripts/pstamp_job_run.pl	(revision 35497)
@@ -151,4 +151,5 @@
         } elsif ($params->{cmf}) {
             $argString .= " -write_cmf";
+            $fileArgs  .= " -sources $params->{cmf}";
             push @file_list, $params->{cmf};
         } else {
Index: trunk/pstamp/src/ppstampMakeStamp.c
===================================================================
--- trunk/pstamp/src/ppstampMakeStamp.c	(revision 35487)
+++ trunk/pstamp/src/ppstampMakeStamp.c	(revision 35497)
@@ -359,9 +359,11 @@
 
         if (options->writeCMF) {
-            pmReadout *astromReadout = NULL;
+            pmReadout *sourcesReadout = NULL;
             if (astrom->fpa != input->fpa) {
-                astromReadout = pmFPAviewThisReadout(srcView, astrom->fpa);
-            }
-            if (!copySources(outReadout, astromReadout, astromReadout, extractRegion)) {
+                sourcesReadout = pmFPAviewThisReadout(srcView, astrom->fpa);
+            } else {
+                sourcesReadout = readout;
+            }
+            if (!copySources(outReadout, sourcesReadout, sourcesReadout, extractRegion)) {
                 psError(PS_ERR_UNKNOWN, false, "failed to extract sources from region of interest.\n");
                 status = false;
@@ -784,4 +786,8 @@
 
     // first look for detections in the input readout. Those would have come from the -sources file
+    if (!inReadout->analysis) {
+        psLogMsg("ppstampMakeStamp", PS_LOG_WARN, "no analysis metadata found on input\n");
+        return false;
+    }
     pmDetections *inDetections = psMetadataLookupPtr (&status, inReadout->analysis, "PSPHOT.DETECTIONS");
     if (!inDetections) {
Index: trunk/pstamp/src/ppstampParseCamera.c
===================================================================
--- trunk/pstamp/src/ppstampParseCamera.c	(revision 35487)
+++ trunk/pstamp/src/ppstampParseCamera.c	(revision 35497)
@@ -119,5 +119,5 @@
         // see if -sources file was supplied. 
         // If so define the file.
-        psPtr sourcesFile = psMetadataLookupStr(&status, config->arguments, "SOURCES");
+        psPtr sourcesFile = psMetadataLookupPtr(&status, config->arguments, "SOURCES");
         if (sourcesFile) {
             pmFPAfile *sources = pmFPAfileBindFromArgs(&status, input, config, "PPSTAMP.INPUT.SOURCES", "SOURCES");
