Index: /trunk/ippTools/src/dettool.c
===================================================================
--- /trunk/ippTools/src/dettool.c	(revision 40466)
+++ /trunk/ippTools/src/dettool.c	(revision 40467)
@@ -1513,4 +1513,30 @@
     psList *exp_id_list = item->data.list;
     psMetadata *where = psMetadataAlloc();
+
+    // make sure that -exp_id was parsed correctly
+    if (item->type == PS_DATA_METADATA_MULTI) {
+        psListIterator *iter = psListIteratorAlloc(item->data.list, 0, false);
+        psMetadataItem *mItem = NULL;
+        while ((mItem = psListGetAndIncrement(iter))) {
+            psS64 exp_id = mItem->data.S64;
+            if (!psMetadataAddS64(where, PS_LIST_TAIL, "exp_id", PS_META_DUPLICATE_OK, "==", exp_id)) {
+                psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");
+                psFree(iter);
+                psFree(where);
+                return false;
+            }
+        }
+        psFree(iter);
+    }
+    if (item->type == PS_DATA_S64) {
+        psS64 exp_id = item->data.S64;
+        if (!psMetadataAddS64(where, PS_LIST_TAIL, "exp_id", PS_META_DUPLICATE_OK, "==", exp_id)) {
+            psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");
+            psFree(where);
+            return false;
+        }
+    }
+
+# if (0)
     // make sure that -exp_id was parsed correctly
     // XXX this can be removed someday
@@ -1541,4 +1567,5 @@
         psAbort("-exp_id was not parsed correctly (this should not happen");
     }
+# endif
 
     // check that the specified exp_ids actually exist in the iteration zero
@@ -1599,7 +1626,7 @@
     psArray *newInputExps = psArrayAllocEmpty(psListLength(exp_id_list));
     while ((mItem = psListGetAndIncrement(iter))) {
-        detInputExpRow *inputExp = psHashLookup(valid_exp_ids,
-                (char *)mItem->data.V);
-        if (!inputExp) {
+      psString exp_idStr = psDBIntToString(mItem->data.S64);
+      detInputExpRow *inputExp = psHashLookup(valid_exp_ids, exp_idStr);
+      if (!inputExp) {
             // rollback
             if (!psDBRollback(config->dbh)) {
@@ -1607,6 +1634,5 @@
             }
             // invalid exp_id
-            psError(PS_ERR_UNKNOWN, false, "exp_id %s is invalid for det_id %" PRId64,
-                    (char *)mItem->data.V, det_id);
+            psError(PS_ERR_UNKNOWN, false, "exp_id %" PRId64 " is invalid for det_id %" PRId64, mItem->data.S64, det_id);
             psFree(iter);
             psFree(valid_exp_ids);
@@ -2452,4 +2478,5 @@
         psMetadata *where = psMetadataAlloc();
         for (long i = 0; i < psArrayLength(inputExps); i++) {
+	  XXX note that exp_id is not a STRING
             if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_id",
                     PS_META_DUPLICATE_OK, "==",
