Index: branches/backtrack/ippTools/src/regtool.c
===================================================================
--- branches/backtrack/ippTools/src/regtool.c	(revision 13967)
+++ branches/backtrack/ippTools/src/regtool.c	(revision 13990)
@@ -620,14 +620,4 @@
         }
 
-        // insert an entry into the chipPendingExp table
-        if (!chipQueueExpTag(config, exp_tag, NULL, NULL, NULL, NULL, NULL)) {
-            // rollback
-            if (!psDBRollback(config->dbh)) {
-                psError(PS_ERR_UNKNOWN, false, "database error");
-            }
-            psError(PS_ERR_UNKNOWN, false, "failed to queue chipPendingExp");
-            psFree(output);
-            return false;
-        }
 
         // set the state for the newExp to stop
@@ -638,4 +628,16 @@
             }
             psError(PS_ERR_UNKNOWN, false, "failed to change newExp.state for exp_tag: %s", exp_tag);
+            psFree(output);
+            return false;
+        }
+
+        // insert an entry into the chipPendingExp table
+        // this can only be run as the newExp's state has been set to stop
+        if (!chipQueueExpTag(config, exp_tag, NULL, NULL, NULL, NULL, NULL)) {
+            // rollback
+            if (!psDBRollback(config->dbh)) {
+                psError(PS_ERR_UNKNOWN, false, "database error");
+            }
+            psError(PS_ERR_UNKNOWN, false, "failed to queue chipPendingExp");
             psFree(output);
             return false;
