Index: /branches/eam_branches/ipp-20130509/Ohana/src/uniphot/Makefile
===================================================================
--- /branches/eam_branches/ipp-20130509/Ohana/src/uniphot/Makefile	(revision 35669)
+++ /branches/eam_branches/ipp-20130509/Ohana/src/uniphot/Makefile	(revision 35670)
@@ -172,5 +172,5 @@
 $(SRC)/initialize_fixstkids.$(ARCH).o     \
 $(SRC)/load_images_fixstkids.$(ARCH).o    \
-$(SRC)/ImageSubsetFixImageIDs.$(ARCH).o  \
+$(SRC)/ImageSubsetFixStackIDs.$(ARCH).o  \
 $(SRC)/update_dvo_fixstkids.$(ARCH).o     \
 $(SRC)/update_catalog_fixstkids.$(ARCH).o \
Index: /branches/eam_branches/ipp-20130509/Ohana/src/uniphot/include/fixstkids.h
===================================================================
--- /branches/eam_branches/ipp-20130509/Ohana/src/uniphot/include/fixstkids.h	(revision 35669)
+++ /branches/eam_branches/ipp-20130509/Ohana/src/uniphot/include/fixstkids.h	(revision 35670)
@@ -54,5 +54,5 @@
 Image        *load_images_fixstkids             PROTO((FITS_DB *db, off_t *Nimage));
 int           update_dvo_fixstkids              PROTO((ImageSubset *image, off_t Nimage));
-int           update_dvo_fixstkids_parallel     PROTO((SkyTable *sky, ImageSubset *image, off_t Nimage));
+int           update_dvo_fixstkids_parallel     PROTO((SkyList *sky, ImageSubset *image, off_t Nimage));
 					        
 void          update_catalog_fixstkids          PROTO((Catalog *catalog));
Index: /branches/eam_branches/ipp-20130509/Ohana/src/uniphot/src/load_images_fixstkids.c
===================================================================
--- /branches/eam_branches/ipp-20130509/Ohana/src/uniphot/src/load_images_fixstkids.c	(revision 35669)
+++ /branches/eam_branches/ipp-20130509/Ohana/src/uniphot/src/load_images_fixstkids.c	(revision 35670)
@@ -58,5 +58,5 @@
 
   // sort the index, start, and stop by the start times:
-  sort_image_externID (externID, imageID, photcodeImage, imageSeq, Nimage);
+  sort_image_externID (imageID, externID, photcodeImage, imageSeq, Nimage);
   
   return;
@@ -96,8 +96,5 @@
       if (extID < externID[Ni]) break;
       if (externID[Ni] == extID) {
-	fprintf (stderr, "found second image ID matching extern ID?\n");
-	fprintf (stderr, "first  ext ID: %d, image ID: %d, photcode: %d\n", externID[N], imageID[N], photcodeImage[N]);
-	fprintf (stderr, "second ext ID: %d, image ID: %d, photcode: %d\n", externID[Ni], imageID[Ni], photcodeImage[Ni]);
-	exit (2);
+	fprintf (stderr, "WARNING: found duplicate extern IDs : ext ID %d, image ID 1: %d (%d), image ID 2: %d (%d)\n", externID[N], imageID[N], photcodeImage[N], imageID[Ni], photcodeImage[Ni]);
       }
     }
Index: /branches/eam_branches/ipp-20130509/Ohana/src/uniphot/src/update_catalog_fixstkids.c
===================================================================
--- /branches/eam_branches/ipp-20130509/Ohana/src/uniphot/src/update_catalog_fixstkids.c	(revision 35669)
+++ /branches/eam_branches/ipp-20130509/Ohana/src/uniphot/src/update_catalog_fixstkids.c	(revision 35670)
@@ -10,4 +10,5 @@
 
   int sourceID, externID, detID;
+  int Nmissed = 0;
 
   for (i = 0; i < catalog[0].Nmeasure; i++) {
@@ -19,11 +20,14 @@
     // reverse engineer the detID, imageID, sourceID from the psps det ID (extID)
     UnpackPSPSStackDetectionID (&sourceID, &externID, &detID, catalog[0].measure[i].extID);
-    myAssert (sourceID = 35, "problem with source ID %d (%0x08 %0x08)", sourceID, catalog[0].measure[i].objID, catalog[0].measure[i].catID);
-    myAssert (detID = catalog[0].measure[i].detID, "problem with det ID %d (%0x08 %0x08)", detID, catalog[0].measure[i].objID, catalog[0].measure[i].catID);
+    myAssert (sourceID == 35, "problem with source ID %d (%0x08 %0x08)", sourceID, catalog[0].measure[i].objID, catalog[0].measure[i].catID);
+    myAssert (detID == catalog[0].measure[i].detID, "problem with det ID %d (%0x08 %0x08)", detID, catalog[0].measure[i].objID, catalog[0].measure[i].catID);
 
     // we now have the externID of the given detection -- find the real image in the image table
     off_t imageID, Seq;
     short Photcode;
-    if (!FindImageID (&imageID, &Seq, &Photcode, externID)) continue;
+    if (!FindImageID (&imageID, &Seq, &Photcode, externID)) {
+      Nmissed ++;
+      continue;
+    }
 
     // if only one matched (or none), the we got the right ID the first time around
@@ -52,4 +56,7 @@
     fprintf (stderr, "found "OFF_T_FMT" matches: "OFF_T_FMT" valid, "OFF_T_FMT" invalid\n", found, Nvalid, Ninvalid);
   }
+  if (Nmissed) {
+    fprintf (stderr, "missed %d stack entries\n", Nmissed);
+  }
 }
 
Index: /branches/eam_branches/ipp-20130509/Ohana/src/uniphot/src/update_dvo_fixstkids.c
===================================================================
--- /branches/eam_branches/ipp-20130509/Ohana/src/uniphot/src/update_dvo_fixstkids.c	(revision 35669)
+++ /branches/eam_branches/ipp-20130509/Ohana/src/uniphot/src/update_dvo_fixstkids.c	(revision 35670)
@@ -15,9 +15,4 @@
   initImageIndex (image, Nimage);
 
-  if (PARALLEL && !HOST_ID) {
-    update_dvo_fixstkids_parallel (sky, image, Nimage);
-    return TRUE;
-  }
-
   // determine the populated SkyRegions overlapping the requested area (default depth)
   if (SINGLE_CPT) {
@@ -27,4 +22,9 @@
   }
   myAssert (skylist, "ooops!");
+
+  if (PARALLEL && !HOST_ID) {
+    update_dvo_fixstkids_parallel (skylist, image, Nimage);
+    return TRUE;
+  }
 
   // update measurements for each populated catalog
@@ -80,5 +80,5 @@
 # define DEBUG 1
 
-int update_dvo_fixstkids_parallel (SkyTable *sky, ImageSubset *image, off_t Nimage) {
+int update_dvo_fixstkids_parallel (SkyList *sky, ImageSubset *image, off_t Nimage) {
 
   char uniquer[12];
@@ -101,6 +101,21 @@
   HostTable *table = HostTableLoad (CATDIR, sky->hosts);
 
-  int i;
+  int i, j;
   for (i = 0; i < table->Nhosts; i++) {
+
+    if (sky->Nregions < table->Nhosts) {
+      // do any of the regions want this host?
+      int wantThisHost = FALSE;
+      for (j = 0; j < sky->Nregions; j++) {
+	if (HostTableTestHost (sky->regions[j], table->hosts[i].hostID)) {
+	  wantThisHost = TRUE;
+	  break;
+	}
+      }
+      if (!wantThisHost) {
+	// fprintf (stderr, "skip host %s\n", table->hosts[i].hostname);
+	continue;
+      }
+    }
 
     // ensure that the paths are absolute path names
@@ -159,4 +174,5 @@
   if (VERBOSE_IMSTATS || SUMMARY_IMSTATS) {
     for (i = 0; i < table->Nhosts; i++) {
+      if (!table->hosts[i].results) continue;
       while (!ImageValidLoad (table->hosts[i].results)) {
 	// failed to get the data from this host.  This can happen for various reasons.  Give the user a chance to try again...
