Index: /trunk/ippScripts/scripts/detrend.pl
===================================================================
--- /trunk/ippScripts/scripts/detrend.pl	(revision 10591)
+++ /trunk/ippScripts/scripts/detrend.pl	(revision 10592)
@@ -208,6 +208,9 @@
 		my $detrend = $item->{det_uri};
 		my $uri = $item->{uri};
-
-		my $command = "$detrend_resid --det_id $det_id --iteration $iteration --exp_tag $exp_tag --class_id $class_id --det_type $det_type --detrend $detrend --camera $camera --input_uri $uri";
+		my $mode = $item->{mode};
+
+		my $command = "$detrend_resid --det_id $det_id --iteration $iteration --exp_tag $exp_tag --class_id $class_id --det_type $det_type --camera $camera --input_uri $uri --mode $mode";
+		$command .= " --detrend $detrend" if defined $detrend;
+
 		my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
 		    run( command => $command, verbose => 1 );
Index: /trunk/ippScripts/scripts/detrend_resid.pl
===================================================================
--- /trunk/ippScripts/scripts/detrend_resid.pl	(revision 10591)
+++ /trunk/ippScripts/scripts/detrend_resid.pl	(revision 10592)
@@ -97,5 +97,5 @@
 $outputRoot = $ipprc->convert_filename_absolute( $outputRoot );
 $input_uri = $ipprc->convert_filename_absolute( $input_uri );
-$detrend = $ipprc->convert_filename_absolute( $detrend );
+$detrend = $ipprc->convert_filename_absolute( $detrend ) if defined $detrend;
 
 my $outputName = $ipprc->filename("PPIMAGE.OUTPUT", $outputRoot, $class_id);
