Index: /trunk/ippTasks/destreak.pro
===================================================================
--- /trunk/ippTasks/destreak.pro	(revision 25426)
+++ /trunk/ippTasks/destreak.pro	(revision 25427)
@@ -114,6 +114,10 @@
       option $DB:$magicToDS_DB
       $run = $run -dbname $DB:$magicToDS_DB
-      $magicToDS_DB ++
-      if ($magicToDS_DB >= $DB:n) set magicToDS_DB = 0
+
+      # only bump database number after we have gone through all of the stages
+      if ($magicDSStage == 0)
+          $magicToDS_DB ++
+          if ($magicToDS_DB >= $DB:n) set magicToDS_DB = 0
+      end
     end
     add_poll_args run
@@ -256,7 +260,7 @@
       # only bump database number after we have gone through all of the stages
       if ($magicDSRevertStage == 0)
-             $magicDSToRevert_DB ++
+          $magicDSToRevert_DB ++
+          if ($magicDSToRevert_DB >= $DB:n) set magicDSToRevert_DB = 0
       end
-      if ($magicDSToRevert_DB >= $DB:n) set magicDSToRevert_DB = 0
     end
     add_poll_args run
