Index: /branches/eam_branches/ohana.20170822/src/relphot/include/relphot.h
===================================================================
--- /branches/eam_branches/ohana.20170822/src/relphot/include/relphot.h	(revision 40261)
+++ /branches/eam_branches/ohana.20170822/src/relphot/include/relphot.h	(revision 40262)
@@ -338,4 +338,6 @@
 int    ApplyOffsets;
 int    SyntheticPhotometry;
+
+int    USE_MCAL_PSF_FOR_STACK_APER;
 
 char  *PhotcodeList;
Index: /branches/eam_branches/ohana.20170822/src/relphot/src/StarOps.c
===================================================================
--- /branches/eam_branches/ohana.20170822/src/relphot/src/StarOps.c	(revision 40261)
+++ /branches/eam_branches/ohana.20170822/src/relphot/src/StarOps.c	(revision 40262)
@@ -496,5 +496,5 @@
 
 	// we need to use McalAPER for stacks (and only stacks)
-	int isStack = isGPC1stack(catalog[i].measureT[m].photcode);
+	int useStackAper = !USE_MCAL_PSF_FOR_STACK_APER && isGPC1stack(catalog[i].measureT[m].photcode);
 
 	// note that measurements for which the image is not selected will not be modified
@@ -503,5 +503,5 @@
 	// set the output calibration
 	catalog[i].measure[m].McalPSF  = McalPSF  + Mmos + Mgrid;
-	catalog[i].measure[m].McalAPER = isStack ? McalAPER + Mmos + Mgrid : McalPSF  + Mmos + Mgrid;
+	catalog[i].measure[m].McalAPER = useStackAper ? McalAPER + Mmos + Mgrid : McalPSF  + Mmos + Mgrid;
 
 	if (catalog[i].measureT[m].dbFlags & ID_MEAS_PHOTOM_UBERCAL) {
Index: /branches/eam_branches/ohana.20170822/src/relphot/src/args.c
===================================================================
--- /branches/eam_branches/ohana.20170822/src/relphot/src/args.c	(revision 40261)
+++ /branches/eam_branches/ohana.20170822/src/relphot/src/args.c	(revision 40262)
@@ -325,4 +325,9 @@
     remove_argument (N, &argc, argv);
     CALIBRATE_STACKS_AND_WARPS = TRUE;
+  }
+  USE_MCAL_PSF_FOR_STACK_APER = FALSE;
+  if ((N = get_argument (argc, argv, "-use-mcal-psf-for-stack-aper"))) {
+    remove_argument (N, &argc, argv);
+    USE_MCAL_PSF_FOR_STACK_APER = TRUE;
   }
 
@@ -696,4 +701,10 @@
   }
 
+  USE_MCAL_PSF_FOR_STACK_APER = FALSE;
+  if ((N = get_argument (argc, argv, "-use-mcal-psf-for-stack-aper"))) {
+    remove_argument (N, &argc, argv);
+    USE_MCAL_PSF_FOR_STACK_APER = TRUE;
+  }
+
   /* define time */
   TimeSelect = FALSE;
Index: /branches/eam_branches/ohana.20170822/src/relphot/src/launch_region_hosts.c
===================================================================
--- /branches/eam_branches/ohana.20170822/src/relphot/src/launch_region_hosts.c	(revision 40261)
+++ /branches/eam_branches/ohana.20170822/src/relphot/src/launch_region_hosts.c	(revision 40262)
@@ -74,4 +74,5 @@
     if (FREEZE_MOSAICS)	     	    strextend (&command, "-mosfreeze");
     if (CALIBRATE_STACKS_AND_WARPS) strextend (&command, "-only-stacks-and-warps");
+    if (USE_MCAL_PSF_FOR_STACK_APER) { strextend (&command, "-use-mcal-psf-for-stack-aper"); }
 
     if (PARALLEL)      	     	    strextend (&command, "-parallel");
Index: /branches/eam_branches/ohana.20170822/src/relphot/src/reload_catalogs.c
===================================================================
--- /branches/eam_branches/ohana.20170822/src/relphot/src/reload_catalogs.c	(revision 40261)
+++ /branches/eam_branches/ohana.20170822/src/relphot/src/reload_catalogs.c	(revision 40262)
@@ -247,4 +247,5 @@
     if (SYNTH_ZERO_POINTS) { strextend (&command, "-synthphot-zpts %s", SYNTH_ZERO_POINTS); }
     if (USE_BASIC_CHECK)   {  strextend (&command, "-basic-image-search"); }
+    if (USE_MCAL_PSF_FOR_STACK_APER) { strextend (&command, "-use-mcal-psf-for-stack-aper"); }
 
     if (!(STAGES & STAGE_CHIP))  { strextend (&command, "-skip-chip"); }
Index: /branches/eam_branches/ohana.20170822/src/relphot/src/relphot_objects.c
===================================================================
--- /branches/eam_branches/ohana.20170822/src/relphot/src/relphot_objects.c	(revision 40261)
+++ /branches/eam_branches/ohana.20170822/src/relphot/src/relphot_objects.c	(revision 40262)
@@ -251,4 +251,5 @@
     if (USE_BASIC_CHECK)   { strextend (&command, "-basic-image-search"); }
     if (USE_ALL_IMAGES)    { strextend (&command, "-use-all-images"); }
+    if (USE_MCAL_PSF_FOR_STACK_APER) { strextend (&command, "-use-mcal-psf-for-stack-aper"); }
 
     if (!(STAGES & STAGE_CHIP))  { strextend (&command, "-skip-chip"); }
Index: /branches/eam_branches/ohana.20170822/src/relphot/src/setMrelCatalog.c
===================================================================
--- /branches/eam_branches/ohana.20170822/src/relphot/src/setMrelCatalog.c	(revision 40261)
+++ /branches/eam_branches/ohana.20170822/src/relphot/src/setMrelCatalog.c	(revision 40262)
@@ -705,5 +705,5 @@
     } else {
       McalPSF   = getMcal  (meas, cat, MAG_CLASS_PSF);
-      McalAPER  = getMcal  (meas, cat, MAG_CLASS_KRON);
+      McalAPER  = USE_MCAL_PSF_FOR_STACK_APER ? getMcal  (meas, cat, MAG_CLASS_PSF) : getMcal  (meas, cat, MAG_CLASS_KRON);
       Mmos      = getMmos  (meas, cat);
       Mgrid     = getMgrid (meas, cat);
@@ -768,5 +768,5 @@
 
     // record the measurement which gave the best value
-    secfilt[Nsec].stackBestOff = (bestEntryMax > -1) ? -1 : bestEntryMax + measureOffset;
+    secfilt[Nsec].stackBestOff = (bestEntryMax == -1) ? -1 : bestEntryMax + measureOffset;
     myAssert (secfilt[Nsec].stackBestOff <= catalog[0].Nmeasure, "stackBestOff out of range");
 
