Index: trunk/psastro/src/psastroDefineFiles.c
===================================================================
--- trunk/psastro/src/psastroDefineFiles.c	(revision 42839)
+++ trunk/psastro/src/psastroDefineFiles.c	(revision 42840)
@@ -61,5 +61,7 @@
 	    return false;
 	}
-	psTime *endtime = psTimeFromString (KHendDate, PS_TIME_TAI);
+	// psTime *endtime = psTimeFromString (KHendDate, PS_TIME_TAI);
+	// 'endtime' and 'time' must be in the same units 
+	psTime *endtime = psTimeFromString (KHendDate, time->type);
 	if (!endtime) {
 	    psError (PM_ERR_CONFIG, false, "KH.CORRECT.APPLY requested, KH.CORRECT.ENDDATE has an invalid date/time");
Index: trunk/psastro/src/psastroLoadRefstars.c
===================================================================
--- trunk/psastro/src/psastroLoadRefstars.c	(revision 42839)
+++ trunk/psastro/src/psastroLoadRefstars.c	(revision 42840)
@@ -139,4 +139,19 @@
     psStringAppend (&getstarCommand, " -region %f %f %f %f -o %s", RAmin, DECmin, RAmax, DECmax, tempFile);
     psTrace ("psastro", 3, "%s\n", getstarCommand);
+
+    // add the MJD for the exposure EPOCH
+    bool ProperMotionApply = psMetadataLookupF32 (&status, recipe, "DVO.GETSTAR.PM.APPLY");
+    if (ProperMotionApply) {
+      pmFPAfile *input = psMetadataLookupPtr (NULL, config->files, source); // we've already done this before
+      myAssert (input, "oops");
+
+      psTime *time = psMetadataLookupPtr(NULL, input->fpa->concepts, "FPA.TIME");
+      if (time->sec == 0 && time->nsec == 0) {
+	psError (PM_ERR_CONFIG, false, "Exposure EPOCH proper motion correction requested, but date/time of exposure not found");
+	return false;
+      }
+      psF64 EpochMJD = psTimeToMJD(time);
+      psStringAppend (&getstarCommand, " -epoch-mjd %lf", EpochMJD);
+    }
 
     psLogMsg("psastro", PS_LOG_INFO, "getstar command: %s", getstarCommand);
Index: trunk/psastro/src/psastroTIODataSave.c
===================================================================
--- trunk/psastro/src/psastroTIODataSave.c	(revision 42839)
+++ trunk/psastro/src/psastroTIODataSave.c	(revision 42840)
@@ -46,4 +46,5 @@
     pmFPAfileActivate (config->files, false, NULL);
     pmFPAfileActivate (config->files, true, "PSASTRO.OUTPUT");
+    pmFPAfileActivate (config->files, true, "PSPHOT.OUTPUT.CFF");
 
     pmFPAview *view = pmFPAviewAlloc (0);
Index: trunk/psastro/src/psastroTIOParseCamera.c
===================================================================
--- trunk/psastro/src/psastroTIOParseCamera.c	(revision 42839)
+++ trunk/psastro/src/psastroTIOParseCamera.c	(revision 42840)
@@ -31,4 +31,27 @@
     output->save = true;
 
+    // check if the user wants CFF output
+    {
+      // select the current recipe
+      psMetadata *recipe  = psMetadataLookupPtr (&status, config->recipes, PSASTRO_RECIPE);
+      if (!recipe) {
+	psError(PSASTRO_ERR_CONFIG, false, "Can't find PSASTRO recipe!\n");
+	return false;
+      }
+
+      bool writeCff = psMetadataLookupBool (&status, recipe, "PSASTRO.SAVE.CFF");
+      if (writeCff) {
+	pmFPAfile *file = pmFPAfileDefineOutputFromFile  (config, input, "PSPHOT.OUTPUT.CFF");
+	if (!file) {
+	  psError (PS_ERR_IO, false, "Can't find the output cff file definition");
+	  return NULL;
+	}
+	if (file->type != PM_FPA_FILE_CFF) {
+	  psError(PS_ERR_IO, true, "%s is not of type %s", "PSPHOT.OUTPUT.CFF", pmFPAfileStringFromType (PM_FPA_FILE_CFF));
+	  return NULL;
+	}
+	file->save = true;
+      }
+    }
 
     // Chip selection: turn on only the chips specified (option is not required)
