Index: trunk/Ohana/src/opihi/dvo/imdata.c
===================================================================
--- trunk/Ohana/src/opihi/dvo/imdata.c	(revision 5448)
+++ trunk/Ohana/src/opihi/dvo/imdata.c	(revision 5451)
@@ -4,8 +4,7 @@
   
   int i, j, k, I;
-  int Nimage, N, NPTS, skip, mode, TimeSelect;
-  int n, Nregion, Ntregion, TimeFormat;
+  int Nimage, N, NPTS, found, mode, TimeSelect;
+  int n, Nregions, NREGIONS, TimeFormat;
   int *subset, Nsubset;
-  char filename[256];
   double trange;
   unsigned long tzero, start, stop, TimeReference;
@@ -81,11 +80,10 @@
 
   /* load sky from correct table */
-  sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, -1, VERBOSE);
-  SkyTableSetFilenames (sky, CATDIR, "cpt");
+  sky = GetSkyTable ();
 
   Nregions = 0;
   NREGIONS = 10;
   ALLOCATE (skylist, SkyList, 1);
-  ALLOCATE (skylist[0].regions, SkyRegions *, NREGIONS);
+  ALLOCATE (skylist[0].regions, SkyRegion *, NREGIONS);
 
   /* for each image of interest, find the appropriate region files */
@@ -94,17 +92,17 @@
 
     if (!FindMosaicForImage (image, Nimage, I)) continue;
-    skyset = SkyListByImage (table, -1, &image[I]);
+    skyset = SkyListByImage (sky, -1, &image[I]);
 
     for (j = 0; j < skyset[0].Nregions; j++) {
       found = FALSE;
-      for (k = 0; (k < skylist[0].Nregion) && !found; k++) {
-	found = !strcmp (skylist[0].regions[k].name, skyset[0].regions[j].name);
+      for (k = 0; (k < skylist[0].Nregions) && !found; k++) {
+	found = !strcmp (skylist[0].regions[k][0].name, skyset[0].regions[j][0].name);
       }
       if (found) continue;
       skylist[0].regions[Nregions] = skyset[0].regions[j];
       Nregions ++;
-      CHECK_REALLOCATE (skylist[0].regions, SkyRegions *, NREGIONS, Nregions, 10);
-    }
-    SkyListFree (skyset);
+      CHECK_REALLOCATE (skylist[0].regions, SkyRegion *, NREGIONS, Nregions, 10);
+    }
+    SkyListFree (skyset, FALSE);
   }	
   free (subset);
@@ -122,5 +120,5 @@
 
     /* get file name and open */
-    catalog.filename = skylist[0].regions[j][0].filename;
+    catalog.filename = (char *) skylist[0].regions[j][0].filename;
     switch (lock_catalog (&catalog, LCK_SOFT)) {
     case 2:
