Index: /branches/eam_branches/ipp-20130307/Ohana/src/libdvo/src/dbExtractAverages.c
===================================================================
--- /branches/eam_branches/ipp-20130307/Ohana/src/libdvo/src/dbExtractAverages.c	(revision 35308)
+++ /branches/eam_branches/ipp-20130307/Ohana/src/libdvo/src/dbExtractAverages.c	(revision 35309)
@@ -141,4 +141,8 @@
       value.Flt = average[0].ChiSqPar;
       break;
+
+    // XXX case AVE_PM_GROUPS:
+    // XXX   value.Int = GetProperMotionGroups (average, measure);
+    // XXX   break;
 
     case AVE_TMEAN:
@@ -278,2 +282,11 @@
 }  
 
+// XXX int GetProperMotionGroups (Average *average, Measure *measure) {
+// XXX   // need the times, excluding ignored detections
+// XXX   // sort the images
+// XXX   for (i = 0; i < Ntimes - 1; i++)  {
+// XXX     if (time[i+1] - time[i] < TRANGE) Ngroup ++;
+// XXX   }
+// XXX   return Ngroup;
+// XXX }
+// XXX 
Index: /branches/eam_branches/ipp-20130307/Ohana/src/libkapa/src/KapaOpen.c
===================================================================
--- /branches/eam_branches/ipp-20130307/Ohana/src/libkapa/src/KapaOpen.c	(revision 35308)
+++ /branches/eam_branches/ipp-20130307/Ohana/src/libkapa/src/KapaOpen.c	(revision 35309)
@@ -4,5 +4,5 @@
 # define MY_PORT_MAX 2520
 # define MY_WAIT 100000
-# define DEBUG 0
+# define DEBUG 1
 
 static int Nvalid = 0;
@@ -121,4 +121,15 @@
 
 accepted:
+  {
+    // we need to do some minimal handshake here.  I will send out 
+    // a 4 char message : KAPA
+    int Nout = write (BindSocket, "KAPA", 4);
+    if (Nout != 4) {
+      fprintf (stderr, "connection failed\n");
+      close (BindSocket);
+      return (-1);
+    }
+  }
+  
   if (DEBUG) fprintf (stderr, "connection accepted\n");
   return (BindSocket);
@@ -205,4 +216,19 @@
   }
 
+  // apparently, I can connect on someone else's port (eg GoogleTalkPlugin)
+  // do a simple handshake before we set !NONBLOCK:
+  char line[5];
+  int Nout = read (InitSocket, line, 4);
+  if (Nout != 4) {
+    fprintf (stderr, "connection failed\n");
+    close (InitSocket);
+    return (-1);
+  }
+  if (strncmp (line, "KAPA", 4)) {
+    fprintf (stderr, "connection to the wrong survey\n");
+    close (InitSocket);
+    return (-1);
+  }
+
   if (DEBUG) fprintf (stderr, "connected on port: %d\n", Address.sin_port);
   if (DEBUG) fprintf (stderr, "connected\n");
@@ -233,4 +259,5 @@
   }
 
+# if (0)
   int pid = KapaLaunchCommand (line);
   if (!pid) {
@@ -238,4 +265,7 @@
     return (-1);
   }
+# else
+  int pid = 1;
+# endif
 
 # define NTRY 500
Index: /branches/eam_branches/ipp-20130307/Ohana/src/relastro/src/UpdateObjects.c
===================================================================
--- /branches/eam_branches/ipp-20130307/Ohana/src/relastro/src/UpdateObjects.c	(revision 35308)
+++ /branches/eam_branches/ipp-20130307/Ohana/src/relastro/src/UpdateObjects.c	(revision 35309)
@@ -224,5 +224,5 @@
 
       if ((mode == FIT_PM_ONLY) || (mode == FIT_PM_AND_PAR)) {
-	// project all of the R,D coordinates to a plane centered on this coordinate set
+	// project all of the R,D coordinates to a plane centered on this coordinate. set
 	// the times to be relative to Tmean (this is required for parallax as well)
 	for (k = 0; k < N; k++) {
@@ -270,4 +270,7 @@
 	  catalog[i].average[j].flags |= ID_STAR_FIT_PAR;
 	  Npar ++;
+	} else {
+	  // need to set mode = FIT_PM_ONLY if we do not fit for parallax
+	  mode = FIT_PM_ONLY;
 	}
       }	  
@@ -321,5 +324,5 @@
 			  fit.uD);
 
-      //make sure that the fit succeeded
+      // make sure that the fit succeeded
       status = TRUE;
       status &= finite(fit.Ro);
