Index: /branches/eam_branches/ipp-20150112/Ohana/src/uniphot/src/cam_correction.c
===================================================================
--- /branches/eam_branches/ipp-20150112/Ohana/src/uniphot/src/cam_correction.c	(revision 37955)
+++ /branches/eam_branches/ipp-20150112/Ohana/src/uniphot/src/cam_correction.c	(revision 37956)
@@ -20,5 +20,4 @@
   }
 
-  CamCorrection *cam = NULL;
   ALLOCATE (cam, CamCorrection, 1);
 
@@ -71,6 +70,11 @@
     if (!gfits_scan (&theader, "FILTER",  "%d", 1, &filter))  return FALSE;
     if (!gfits_scan (&theader, "DIR",     "%d", 1, &dir))     return FALSE;
-    if (!gfits_scan (&theader, "X_CHIP",  "%d", 1, &ix))      return FALSE;
-    if (!gfits_scan (&theader, "Y_CHIP",  "%d", 1, &iy))      return FALSE;
+
+    // XXX NOTE: astroflat.20150209.fits has ix and iy backwards in header
+    // if (!gfits_scan (&theader, "X_CHIP",  "%d", 1, &ix))      return FALSE;
+    // if (!gfits_scan (&theader, "Y_CHIP",  "%d", 1, &iy))      return FALSE;
+
+    if (!gfits_scan (&theader, "X_CHIP",  "%d", 1, &iy))      return FALSE;
+    if (!gfits_scan (&theader, "Y_CHIP",  "%d", 1, &ix))      return FALSE;
 
     Matrix *matrix = NULL;
@@ -82,5 +86,5 @@
     myAssert (index < cam->Nvalues, "index too big");
 
-    myAssert (!cam->matrix[i], "entry already assigned?");
+    myAssert (!cam->matrix[index], "entry already assigned?");
 
     // assert that cam->matrix[index] is NULL?
Index: /branches/eam_branches/ipp-20150112/Ohana/src/uniphot/src/update_catalog_setastrom.c
===================================================================
--- /branches/eam_branches/ipp-20150112/Ohana/src/uniphot/src/update_catalog_setastrom.c	(revision 37955)
+++ /branches/eam_branches/ipp-20150112/Ohana/src/uniphot/src/update_catalog_setastrom.c	(revision 37956)
@@ -127,5 +127,5 @@
       
       // 10134 : r, XY34 -> filtCode = 1
-      int filtCode = (int)((measure->photcode % 100) / 100); 
+      int filtCode = (int)((measure->photcode % 1000) / 100); 
 
       // correction is in arcseconds
@@ -265,6 +265,6 @@
     }
     if (CAM_FILE) {
-      measure[0].XoffCAM = -dX_DCR / pltScale;
-      measure[0].YoffCAM = -dY_DCR / pltScale;
+      measure[0].XoffCAM = -dX_CAM / pltScale;
+      measure[0].YoffCAM = -dY_CAM / pltScale;
     }
     if (CAM_RESET) {
