Index: /tags/ipp-20110218/ippScripts/scripts/magic_destreak_revert.pl
===================================================================
--- /tags/ipp-20110218/ippScripts/scripts/magic_destreak_revert.pl	(revision 30758)
+++ /tags/ipp-20110218/ippScripts/scripts/magic_destreak_revert.pl	(revision 30759)
@@ -163,5 +163,9 @@
         $image = $path_base . ".fits";
     }
-    $bimage = $backup_path_base . ".fits";
+    if ($backup_path_base =~ /.*\.fits$/) {
+        $bimage = $backup_path_base;
+    } else {
+        $bimage = $backup_path_base . ".fits";
+    }
 } elsif ($stage eq "chip") {
     # Check to see if we're using dynamic masks
@@ -303,5 +307,5 @@
 sub revert_files {
     my $replace = shift;
-    return if !$replace;
+#    return if !$replace;
 
     my $image = shift;
@@ -317,10 +321,10 @@
 
     if ($image) {
-        revert_file($image, $bimage) or
+        revert_file($replace, $image, $bimage) or
             &my_die("failed to restore image file", $magic_ds_id, $component, $PS_EXIT_CONFIG_ERROR);
     }
 
     if ($mask) {
-        if (!revert_file($mask, $bmask)) {
+        if (!revert_file($replace, $mask, $bmask)) {
             &my_die("failed to restore mask file", $magic_ds_id, $component, $PS_EXIT_CONFIG_ERROR);
         }
@@ -328,5 +332,5 @@
 
     if ($ch_mask) {
-        if (!revert_file($ch_mask, $bch_mask)) {
+        if (!revert_file($replace, $ch_mask, $bch_mask)) {
             &my_die("failed to restore chip mask file", $magic_ds_id, $component, $PS_EXIT_CONFIG_ERROR);
         }
@@ -335,15 +339,15 @@
 
     if ($weight) {
-        revert_file($weight, $bweight) or
+        revert_file($replace, $weight, $bweight) or
             &my_die("failed to restore variance image", $magic_ds_id, $component, $PS_EXIT_CONFIG_ERROR);
     }
 
     if ($sources) {
-        revert_file($sources, $bsources) or
+        revert_file($replace, $sources, $bsources) or
             &my_die("failed to restore sources file", $magic_ds_id, $component, $PS_EXIT_CONFIG_ERROR);
     }
 
     if ($astrom) {
-        revert_file($astrom, $bastrom) or
+        revert_file($replace, $astrom, $bastrom) or
             &my_die("failed to restore astrometry file", $magic_ds_id, $component, $PS_EXIT_CONFIG_ERROR);
     }
@@ -367,4 +371,5 @@
 sub revert_file
 {
+    my $replace = shift;
     my $original = shift;
     my $backup   = shift;
