Index: trunk/pstamp/scripts/pstamp_job_run.pl
===================================================================
--- trunk/pstamp/scripts/pstamp_job_run.pl	(revision 30517)
+++ trunk/pstamp/scripts/pstamp_job_run.pl	(revision 30528)
@@ -145,5 +145,9 @@
             # user required uncensored but since stage isn't chip we can't rebuild them
             my_die("uncensored inputs not available for job $job_id", $job_id, $PSTAMP_NOT_AVAILABLE);
-        } elsif (($options & $PSTAMP_REQUEST_UNCENSORED) and ($stage ne 'chip')) {
+        } elsif (($options & $PSTAMP_REQUEST_UNCENSORED) and ($params->{state} eq 'update') and ($stage ne 'chip')) {
+            # we can only restore pixels for chip stage images if the data has been updated.
+            # XXX: this test is not quite good enough. If all components have been updated then the
+            # state will be 'full' But this will get us going.
+            print "Run state is update: will make stamps from destreaked $stage images.\n";
             # make stamps from uncensored images
             $muggle = 0;
@@ -153,6 +157,8 @@
             @file_list = ();
             $tmproot = "$outdir/$job_id";
-            mkdir $tmproot or
-                my_die( "failed to create temporary directory $tmproot", $job_id, $PS_EXIT_UNKNOWN_ERROR);
+            if (! -e $tmproot) {
+                mkdir $tmproot or
+                    my_die( "failed to create temporary directory $tmproot", $job_id, $PS_EXIT_UNKNOWN_ERROR);
+            }
             my $muggle_command = "$streaksreplace -stage $stage -tmproot $tmproot";
             # find the "directory" of the input path_base
@@ -180,5 +186,5 @@
                 $base = basename($variance);
                 $tmpVariance = "$tmproot/$base";
-                $newFileArgs .= " -weight $tmpVariance";
+                $newFileArgs .= " -variance $tmpVariance";
                 my $recVariance = "$inputdir/REC_$base";
                 $muggle_command .= " -weight $variance -recweight $recVariance";
