Index: branches/eam_branches/ohana.20170822/src/relphot/src/setMrelCatalog.c
===================================================================
--- branches/eam_branches/ohana.20170822/src/relphot/src/setMrelCatalog.c	(revision 40263)
+++ branches/eam_branches/ohana.20170822/src/relphot/src/setMrelCatalog.c	(revision 40265)
@@ -2,6 +2,6 @@
 
 # if (0)
-# define TEST_OBJ_ID 0x0000000e
-# define TEST_CAT_ID 0x000076ee
+# define TEST_OBJ_ID 0x000098f9 
+# define TEST_CAT_ID 0x00005ad3
 # else
 # define TEST_OBJ_ID 0
@@ -688,4 +688,6 @@
 
     off_t meas = bestEntryMax;
+    off_t measSeq = meas + measureOffset;
+
     myAssert (meas >= 0, "this should not happen");
 
@@ -695,5 +697,5 @@
     
     // match measurement to its image (this is just a check, right?)
-    if (getImageEntry (meas, cat) < 0) {
+    if (getImageEntry (measSeq, cat) < 0) {
       // measurements without an image are either external reference photometry or
       // data for which the associated image has not been loaded (probably because of
@@ -704,8 +706,8 @@
       Mgrid    = 0.0;
     } else {
-      McalPSF   = getMcal  (meas, cat, MAG_CLASS_PSF);
-      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);
+      McalPSF   = getMcal  (measSeq, cat, MAG_CLASS_PSF);
+      McalAPER  = USE_MCAL_PSF_FOR_STACK_APER ? getMcal  (measSeq, cat, MAG_CLASS_PSF) : getMcal  (measSeq, cat, MAG_CLASS_KRON);
+      Mmos      = getMmos  (measSeq, cat);
+      Mgrid     = getMgrid (measSeq, cat);
     }
     
