Index: /branches/eam_branches/ipp-20150625/Ohana/src/relastro/src/FitChip.c
===================================================================
--- /branches/eam_branches/ipp-20150625/Ohana/src/relastro/src/FitChip.c	(revision 38698)
+++ /branches/eam_branches/ipp-20150625/Ohana/src/relastro/src/FitChip.c	(revision 38699)
@@ -81,5 +81,7 @@
     }
 
-    if (VERBOSE2) fprintf (stderr, "using %d for %s\n", order_use, image[0].name);
+    if (VERBOSE2) {
+      fprintf (stderr, "using %d for %s\n", order_use, image[0].name);
+    }
 
     // when fitting the map, first fit a linear model (below? change Npolyterms to -1)
@@ -92,5 +94,5 @@
     for (i = 0; i < Nmatch; i++) {
       if (raw[i].mask) continue;
-      fit_add (fit, raw[i].X, raw[i].Y, ref[i].L, ref[i].M, raw[i].dPos);
+      fit_add (fit, raw[i].X, raw[i].Y, ref[i].L, ref[i].M, ref[i].dPos);
     }
 
@@ -310,9 +312,10 @@
   int i, N;
 
-  float *x, *y, *dX, *dY;
+  float *x, *y, *dX, *dY, *dP;
   ALLOCATE (x,  float, Npts);
   ALLOCATE (y,  float, Npts);
   ALLOCATE (dX, float, Npts);
   ALLOCATE (dY, float, Npts);
+  ALLOCATE (dP, float, Npts);
 
   N = 0;
@@ -323,4 +326,5 @@
     dX[N] = ref[i].X - raw[i].X;
     dY[N] = ref[i].Y - raw[i].Y;
+    dP[N] = ref[i].dPos;
     N++;
   }
@@ -329,6 +333,6 @@
   // (L,M) = f(X',Y') : (X',Y') = (X,Y) + (dX,dY)
 
-  AstromOffsetMapFit (map, x, y, dX, N, TRUE);
-  AstromOffsetMapFit (map, x, y, dY, N, FALSE);
+  AstromOffsetMapFit (map, x, y, dX, dP, N, TRUE);
+  AstromOffsetMapFit (map, x, y, dY, dP, N, FALSE);
 
   AstromOffsetMapRepair (map, TRUE);
@@ -339,4 +343,5 @@
   free (dX);
   free (dY);
+  free (dP);
 
   return TRUE;
