Index: trunk/ippScripts/scripts/detrend_stack.pl
===================================================================
--- trunk/ippScripts/scripts/detrend_stack.pl	(revision 13946)
+++ trunk/ippScripts/scripts/detrend_stack.pl	(revision 13989)
@@ -134,12 +134,15 @@
 }
 
-my $bg = ($stats->bg_mean() or 'NAN');
-my $bg_stdev = ($stats->bg_stdev() or 'NAN');
-my $bg_mean_stdev = ($stats->bg_mean_stdev() or 'NAN');
+my $bg            = $stats->bg_mean();
+my $bg_stdev      = $stats->bg_stdev();
+my $bg_mean_stdev = $stats->bg_mean_stdev();
 
 # Add the resultant into the database
 unless ($no_update) {
-    my $command = "$dettool -addstacked -det_id $det_id -iteration $iter -class_id $class_id" .
-	" -uri $outputStack -recip $recipe"; # Command to run
+    my $command = "$dettool -addstacked";
+    $command .= " -det_id $det_id -iteration $iter";
+    $command .= " -class_id $class_id";
+    $command .= " -uri $outputStack";
+    $command .= " -recip $recipe";
     $command .= " -bg $bg -bg_stdev $bg_stdev -bg_mean_stdev $bg_mean_stdev";
     $command .= " -dbname $dbname" if defined $dbname;
