Index: trunk/psastro/src/psastroAnalysis.c
===================================================================
--- trunk/psastro/src/psastroAnalysis.c	(revision 21409)
+++ trunk/psastro/src/psastroAnalysis.c	(revision 23412)
@@ -45,5 +45,5 @@
 
     // load the reference stars overlapping the data stars
-    psArray *refs = psastroLoadRefstars(config);
+    psArray *refs = psastroLoadRefstars(config, "PSASTRO.INPUT");
     if (!refs) {
         psError (PSASTRO_ERR_UNKNOWN, false, "failed to load reference data\n");
@@ -56,9 +56,10 @@
     }
 
-    if (!psastroChooseRefstars (config, refs)) {
+    if (!psastroChooseRefstars (config, refs, "PSASTRO.INPUT")) {
         psError (PSASTRO_ERR_UNKNOWN, false, "failed to select reference data for chips\n");
         psFree(refs);
         return false;
     }
+    psFree (refs);  // refs of interest are saved on readout->analysis
 
     // check the command-line arguments first
@@ -79,5 +80,4 @@
         if (!psastroChipAstrom (config)) {
             psError (PSASTRO_ERR_UNKNOWN, false, "failed to perform single chip astrometry\n");
-            psFree(refs);
             return false;
         }
@@ -86,5 +86,4 @@
         if (!psastroMosaicAstrom (config)) {
             psError (PSASTRO_ERR_UNKNOWN, false, "failed to perform mosaic camera astrometry\n");
-            psFree(refs);
             return false;
         }
@@ -100,5 +99,4 @@
     // psastroStackAstrom (config, refs);
 
-    psFree (refs);
     return true;
 }
