Index: branches/eam_branches/ipp-20110213/pstamp/scripts/pstamp_checkdependent.pl
===================================================================
--- branches/eam_branches/ipp-20110213/pstamp/scripts/pstamp_checkdependent.pl	(revision 30628)
+++ branches/eam_branches/ipp-20110213/pstamp/scripts/pstamp_checkdependent.pl	(revision 30676)
@@ -193,12 +193,15 @@
 
     if (!$job_fault and ($stage eq 'chip')) {
-        # should only get here with data_state 'full' and perhaps destreaking not done
-        my_die ("Unexpected state for ${stage}Run $stage_id $state", $PS_EXIT_PROG_ERROR)
-            if $it->{data_state} ne 'full';
-
-        # chip processing is done, start destreaking.
-        my @chips;
-        push @chips, $it->{class_id};
-        $job_fault = check_states_magicDSRun($stage, $stage_id, \@chips, $rlabel, $need_magic, $it->{raw_magicked}, $it->{magic_ds_id}, $it->{dsRun_state});
+        # what about "error_cleaned" ?
+        if (! ($it->{data_state} =~ /cleaned/) ) {
+            # should only get here with data_state 'full' and perhaps destreaking not done
+            my_die ("Unexpected state for ${stage}Run $stage_id $state", $PS_EXIT_PROG_ERROR)
+                if $it->{data_state} ne 'full';
+
+            # chip processing is done, start destreaking.
+            my @chips;
+            push @chips, $it->{class_id};
+            $job_fault = check_states_magicDSRun($stage, $stage_id, \@chips, $rlabel, $need_magic, $it->{raw_magicked}, $it->{magic_ds_id}, $it->{dsRun_state});
+        }
     }
 
@@ -245,4 +248,8 @@
             # caller will fault the jobs
             return $error_code;
+        } elsif ($chip->{dsRun_state} eq 'failed_revert') {
+            # XXX: revert failures are rarely fixed. give up but say it's just not available not GONE 
+            print "magicDSRun.state = $dsRun_state for chipRun $stage_id is in state failed_revert cannot update\n";
+            return $PSTAMP_NOT_AVAILABLE;
         } elsif (($chip->{data_state} ne 'update') and ($chip->{data_state} ne 'full')) {
 
Index: branches/eam_branches/ipp-20110213/pstamp/scripts/pstamp_finish.pl
===================================================================
--- branches/eam_branches/ipp-20110213/pstamp/scripts/pstamp_finish.pl	(revision 30628)
+++ branches/eam_branches/ipp-20110213/pstamp/scripts/pstamp_finish.pl	(revision 30676)
@@ -228,4 +228,6 @@
                 close JRL;
             } else {
+                my_die("No reglist for successful job: $job_id", $req_id, $PS_EXIT_PROG_ERROR) 
+                    if $fault eq $PSTAMP_SUCCESS;
                 print STDERR "no reglist file for job $job_id\n" if $verbose;
                 print $tdf "$rownum|$fault|$error_string|0|$job_id|";
Index: branches/eam_branches/ipp-20110213/pstamp/scripts/pstamp_get_image_job.pl
===================================================================
--- branches/eam_branches/ipp-20110213/pstamp/scripts/pstamp_get_image_job.pl	(revision 30628)
+++ branches/eam_branches/ipp-20110213/pstamp/scripts/pstamp_get_image_job.pl	(revision 30676)
@@ -87,7 +87,4 @@
 }
 
-my $outdir = dirname($output_base);
-my $prefix = basename($output_base) . "_";
-my $results_file = $output_base . ".bundle_results";
 
 # Look for programs we need
@@ -99,13 +96,16 @@
 }
 
+my $outdir = dirname($output_base);
+my $basename = basename($path_base);
+my $outroot = $output_base ."_" . $basename;
+my $results_file = $output_base . ".bundle_results";
+
 {
     my $command = "$dist_bundle --camera $camera --stage $stage --stage_id $stage_id";
-    $command .= " --component $component";
-    $command .= " --path_base $path_base --outdir $outdir --results_file $results_file";
-    $command .= " --prefix $prefix";
+    $command .= " --results_file $results_file";
+    $command .= " --component $component --path_base $path_base --outroot $outroot";
+#    XXX: we need to do some work if we want to support muggle bundles
+#    $command .= " --no_magic if $no_magic";
     $command .= " --magicked" if $magicked;
-    # DANGER DANGER do not commit next line
-#    $command .= " --no_magic";
-    # DANGER DANGER do not commit last line
     $command .= " --dbname $dbname" if $dbname;
     $command .= " --verbose" if $verbose;
