Index: branches/pap/ippTools/src/magicdstool.c
===================================================================
--- branches/pap/ippTools/src/magicdstool.c	(revision 27708)
+++ branches/pap/ippTools/src/magicdstool.c	(revision 28003)
@@ -572,5 +572,4 @@
     // we can transition by query as well
 
-
     psMetadata *where = psMetadataAlloc();
     PXOPT_COPY_STR(config->args, where, "-label", "label", "==");
@@ -1234,6 +1233,14 @@
         psFree(whereClause);
     } else {
-        psError(PS_ERR_UNKNOWN, true, "search arugments are required");
-        return false;
+        psError(PS_ERR_UNKNOWN, true, "search arguments are required");
+        return false;
+    }
+
+    if (!strcmp(state, "goto_cleaned")) {
+        // Don't set state back to goto_cleaned if it is already cleaned
+        psStringAppend(&query, " AND (magicDSRun.state != 'cleaned')");
+
+        // don't clean up magicDSRun's where stage is camera
+        psStringAppend(&query, " AND (magicDSRun.stage != 'camera')");
     }
 
