Index: trunk/ippScripts/scripts/magic_destreak.pl
===================================================================
--- trunk/ippScripts/scripts/magic_destreak.pl	(revision 27954)
+++ trunk/ippScripts/scripts/magic_destreak.pl	(revision 27957)
@@ -212,5 +212,4 @@
                     &my_die("Unable to parse metadata list", $magic_ds_id, $component, $PS_EXIT_PROG_ERROR);
 
-            $temp_dir = tempdir( CLEANUP => !$save_temps);
             ($sfh, $skycell_list) = tempfile( "/tmp/skycell_list.XXXX", UNLINK => !$save_temps);
 
@@ -221,4 +220,7 @@
                 } else {
                     # diff run must have been cleaned up, need to create this skycell file on the fly
+                    if (!defined $temp_dir ) {
+                        $temp_dir = tempdir( CLEANUP => !$save_temps);
+                    }
                     my $skycell_id = $skycell->{skycell_id};
                     $skycell_uri = "$temp_dir/$skycell_id";
