Index: trunk/ippScripts/scripts/lap_science.pl
===================================================================
--- trunk/ippScripts/scripts/lap_science.pl	(revision 37812)
+++ trunk/ippScripts/scripts/lap_science.pl	(revision 37833)
@@ -34,5 +34,5 @@
 my $qstack_threshold     = 0.05; # Only make a quickstack if more than 5% of the exposures require it.
 my $minimum_stack_inputs = 2;    # We can avoid magicking stack inputs if we have more than this number.
-my $maximum_stack_inputs = 25;   # This is the place-holder guess on how big a stack we should process locally
+my $maximum_stack_inputs = 25;   # This is the place-holder guess on how big a stack we should process locally.  25 is the best guess.
 my $do_updates_pv2       = 0;    # Do updates using the calls needed for PV2.  
 
@@ -1058,5 +1058,5 @@
     unless ($success) {
 	$error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
-	&my_die("Unable to perform stacktool -definebyquery: $error_code", $lap_id);
+	&my_die("Unable to perform stacktool -definebyquery: $error_code :: $command", $lap_id);
     }
     my $stacks_made = $mdcParser->parse_list(join "", @$stdout_buf) or
@@ -1066,4 +1066,5 @@
     ## Queue the "deep" stacks that will run locally.
     my $deep_minimum = $maximum_stack_inputs + 1;
+    if ($deep_minimum < 2) { $deep_minimum = 2; }
     $command = "$stacktool ";
     $command .= " -pretend " if defined $debug;
@@ -1079,11 +1080,11 @@
     unless ($success) {
 	$error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
-	&my_die("Unable to perform stacktool -definebyquery: $error_code", $lap_id);
-    }
-    my $stacks_made_deep .= $mdcParser->parse_list(join "", @$stdout_buf) or
+	&my_die("Unable to perform stacktool -definebyquery: $error_code :: $command", $lap_id);
+    }
+    my $stacks_made_deep = $mdcParser->parse_list(join "", @$stdout_buf) or
 	&my_die("unable to parse metadata from stacktool -definebyquery", $lap_id, "");    
 
     # Append deep stacks to stacks so we can get a complete count later.
-    push @{ $stacks_made}, @{ $stacks_made_deep };
+    push @{ $stacks_made }, @{ $stacks_made_deep };
     
     ## Determine the sass_id so we can record it in the database.
@@ -1449,5 +1450,5 @@
 
     my @clean_modes = (
-#	'chiptool -dbname @DBNAME@ -updaterun -set_state goto_cleaned -set_label goto_cleaned -label @LABEL@ -chip_id @CHIP_ID@',
+	'chiptool -dbname @DBNAME@ -updaterun -set_state goto_cleaned -set_label goto_cleaned -label @LABEL@ -chip_id @CHIP_ID@',
 #	'warptool -dbname @DBNAME@ -updaterun -set_state goto_cleaned -set_label goto_cleaned -label @LABEL@ -warp_id @WARP_ID@',
 	'difftool -dbname @DBNAME@ -updaterun -set_state goto_cleaned -set_label goto_cleaned -label @LABEL@ -diff_id @DIFF_ID@',
