Index: /trunk/Ohana/src/addstar/src/find_matches.c
===================================================================
--- /trunk/Ohana/src/addstar/src/find_matches.c	(revision 4824)
+++ /trunk/Ohana/src/addstar/src/find_matches.c	(revision 4825)
@@ -13,5 +13,5 @@
   Coords tcoords;
   int Nsecfilt, Nsec, MTIME;
-  short int Mrel, *Mval;
+  short int Mcat, *Mval;
 
   /* photcode data - must by of type DEP, (PRI, SEC) - probably should restrict to DEP */
@@ -165,10 +165,9 @@
       catalog[0].measure[Nmeas].theta    = MIN ((255/360)*stars[N].df, NO_ERR);
 	
-      /*** this should probably use the mag lookup functions - zeropoints are incorrectly applied ***/
       /* it is not valid to pass PRI/SEC/REF photcodes to this routine */
       /* check for entries in the secfilt lists */
-      Mrel = catalog[0].measure[Nmeas].M + secz * thiscode[0].K;
+      Mcat = iPhotCat (&catalog[0].measure[Nmeas]);
       Mval = (Nsec == -1) ? &catalog[0].average[n].M : &catalog[0].secfilt[n*Nsecfilt+Nsec].M;
-      if (*Mval == NO_MAG) *Mval = Mrel;
+      if (*Mval == NO_MAG) *Mval = Mcat;
 
       /** this is a little tricky: the new measures are not in the measure sequence
@@ -292,7 +291,7 @@
     catalog[0].measure[Nmeas].theta    = MIN ((255/360)*stars[N].df, NO_ERR);
 
-    Mrel = catalog[0].measure[Nmeas].M + secz * thiscode[0].K;
+    Mcat = iPhotCat (&catalog[0].measure[Nmeas]);
     Mval = (Nsec == -1) ? &catalog[0].average[Nave].M : &catalog[0].secfilt[Nave*Nsecfilt+Nsec].M;
-    if (*Mval == NO_MAG) *Mval = Mrel;
+    if (*Mval == NO_MAG) *Mval = Mcat;
 
     /** now add references from all previous non-detection observations of this spot on the sky */
