Index: trunk/ippTools/src/regtool.c
===================================================================
--- trunk/ippTools/src/regtool.c	(revision 14059)
+++ trunk/ippTools/src/regtool.c	(revision 14091)
@@ -629,5 +629,4 @@
             return false;
         }
-        psFree(rawExp);
 
         // if this is a detrend image don't put it in the chip queue (and we're
@@ -641,4 +640,5 @@
                 }
                 psError(PS_ERR_UNKNOWN, false, "failed to change newExp.state for exp_id: %s", exp_id);
+                psFree(rawExp);
                 psFree(output);
                 return false;
@@ -655,4 +655,5 @@
             }
             psError(PS_ERR_UNKNOWN, false, "failed to change newExp.state for exp_id: %s", exp_id);
+            psFree(rawExp);
             psFree(output);
             return false;
@@ -661,5 +662,12 @@
         // insert an entry into the chipPendingExp table
         // this can only be run as the newExp's state has been set to stop
-        if (!pxchipQueueByExpTag(config, exp_id, NULL, NULL, NULL, NULL, NULL)) {
+        if (!pxchipQueueByExpTag(config,
+                    exp_id, // exp_id is the string version, rawExp->exp_id isa int
+                    rawExp->workdir,
+                    NULL, // label
+                    rawExp->reduction,
+                    NULL, // expgroup
+                    NULL  // dvodb
+        )) {
             // rollback
             if (!psDBRollback(config->dbh)) {
@@ -667,7 +675,9 @@
             }
             psError(PS_ERR_UNKNOWN, false, "failed to queue chipPendingExp");
+            psFree(rawExp);
             psFree(output);
             return false;
         }
+        psFree(rawExp);
     }
     psFree(output);
@@ -924,4 +934,16 @@
     }
 
+    psString workdir = psMetadataLookupStr(&status, config->args, "-workdir");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -workdir");
+        return false;
+    }
+
+    psString reduction = psMetadataLookupStr(&status, config->args, "-reduction");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -reduction");
+        return false;
+    }
+
     psString filter = psMetadataLookupStr(&status, config->args, "-filter");
     if (!status) {
@@ -1065,5 +1087,6 @@
         exp_type,
         filelevel,
-        exp->workdir,
+        workdir ? workdir : exp->workdir,
+        reduction ? reduction : exp->reduction,
         filter,
         airmass,
