Index: /trunk/ippTools/share/disttool_revertrun_delete.sql
===================================================================
--- /trunk/ippTools/share/disttool_revertrun_delete.sql	(revision 24459)
+++ /trunk/ippTools/share/disttool_revertrun_delete.sql	(revision 24460)
@@ -2,3 +2,4 @@
 USING distComponent, distRun
 WHERE distComponent.dist_id = distRun.dist_id
+    AND distRun.state = 'new'
     AND distComponent.fault != 0
Index: /trunk/ippTools/share/disttool_revertrun_update.sql
===================================================================
--- /trunk/ippTools/share/disttool_revertrun_update.sql	(revision 24459)
+++ /trunk/ippTools/share/disttool_revertrun_update.sql	(revision 24460)
@@ -1,5 +1,4 @@
 UPDATE distRun
-JOIN distComponent USING(dist_id)
-SET distRun.state = 'new', distRun.fault = 0
-WHERE distComponent.fault != 0
-    OR distRun.fault != 0
+SET distRun.fault = 0
+WHERE distRun.state = 'new'
+    AND distRun.fault != 0
Index: /trunk/ippTools/src/disttool.c
===================================================================
--- /trunk/ippTools/src/disttool.c	(revision 24459)
+++ /trunk/ippTools/src/disttool.c	(revision 24460)
@@ -488,5 +488,9 @@
     PXOPT_COPY_STR(config->args, where, "-state", "state", "==");
     PXOPT_COPY_STR(config->args, where, "-label", "label", "==");
-    PXOPT_COPY_S16(config->args, where, "-fault", "fault", "==");
+
+    // we need to disambiguate fault so make a copy of the where list before adding fault
+    psMetadata *whereComponent = psMetadataCopy(NULL, where);
+    PXOPT_COPY_S16(config->args, where,  "-fault", "distRun.fault", "==");
+    PXOPT_COPY_S16(config->args, whereComponent, "-fault", "distComponent.fault", "==");
 
     // It might be useful to be able to query by the parameters of the underlying runs
@@ -533,15 +537,4 @@
 
         numUpdated = psDBAffectedRows(config->dbh);
-
-#ifdef notdef
-        // don't need this. distRun.state may still be in 'new' state
-        if (numUpdated < 1) {
-            psError(PS_ERR_UNKNOWN, false, "should have affected at least 1 row");
-            if (!psDBRollback(config->dbh)) {
-                psError(PS_ERR_UNKNOWN, false, "database error");
-            }
-            return false;
-        }
-#endif
     }
 
@@ -560,6 +553,6 @@
         }
 
-        if (psListLength(where->list)) {
-            psString whereClause = psDBGenerateWhereConditionSQL(where, NULL);
+        if (psListLength(whereComponent->list)) {
+            psString whereClause = psDBGenerateWhereConditionSQL(whereComponent, NULL);
             psStringAppend(&query, " AND %s", whereClause);
             psFree(whereClause);
@@ -582,4 +575,5 @@
 
     psFree(where);
+    psFree(whereComponent);
 
     if (!psDBCommit(config->dbh)) {
