Index: trunk/ippScripts/scripts/magic_destreak_cleanup.pl
===================================================================
--- trunk/ippScripts/scripts/magic_destreak_cleanup.pl	(revision 30630)
+++ trunk/ippScripts/scripts/magic_destreak_cleanup.pl	(revision 30803)
@@ -102,4 +102,5 @@
 my $cam_path_base = $run->{cam_path_base};
 my $cam_reduction = $run->{cam_reduction};
+my $replace = $run->{re_place};
 $cam_reduction = 'DEFAULT' if !$cam_reduction or ($cam_reduction eq 'NULL');
 
@@ -111,5 +112,5 @@
 
 &my_die("unexpected run state found: $state", $magic_ds_id, $PS_EXIT_CONFIG_ERROR) if $state ne "goto_cleaned";
-&my_die("clean not allowed for raw stage, use goto_restore", $magic_ds_id, $PS_EXIT_CONFIG_ERROR) if $stage eq "raw";
+&my_die("cleanup not allowed for raw stage, use goto_restore", $magic_ds_id, $PS_EXIT_CONFIG_ERROR) if $stage eq "raw" and $replace;
 
 my $recipe_psastro;
@@ -217,4 +218,12 @@
                 # $bsources = $ipprc->filename("$name.SOURCES", $backup_path_base);
             }
+        } elsif ($stage eq "raw") {
+            if ($backup_path_base) {
+                if ($backup_path_base =~ /fits/) {
+                    $bimage = $backup_path_base;
+                } else {
+                    $bimage = $backup_path_base . ".fits";
+                }
+            }
         }
 
