Index: trunk/ippScripts/scripts/detrend_create_resid.pl
===================================================================
--- trunk/ippScripts/scripts/detrend_create_resid.pl	(revision 8763)
+++ trunk/ippScripts/scripts/detrend_create_resid.pl	(revision 8983)
@@ -120,5 +120,10 @@
 	"-b2_uri $bin2Name"; # Command to run dettool
     $command .= " -bg " . $stats->bg_mean();
-    $command .= " -bg_stdev " . $stats->bg_stdev();
+    if (defined($stats->bg_stdev())) {
+	$command .= " -bg_stdev " . $stats->bg_stdev();
+    } else {
+	# May be undefined if there is only a single imfile
+	$command .= ' -bg_stdev 0';
+    }
     $command .= " -bg_mean_stdev " . $stats->bg_mean_stdev();
 
