Index: trunk/ippScripts/scripts/lap_science.pl
===================================================================
--- trunk/ippScripts/scripts/lap_science.pl	(revision 31475)
+++ trunk/ippScripts/scripts/lap_science.pl	(revision 31494)
@@ -120,5 +120,5 @@
     # This is a puzzler... chiptool doesn't actually return a useful metadata.  We'll just scrape it from the database for now.
 
-    my $command = "$chiptool -listrun -exp_id $exp_id -label $label -data_group $data_group";
+    my $command = "$chiptool -listrun -pstamp_order -exp_id $exp_id -label $label -data_group $data_group";
     $command .= " -dbname $dbname " if defined $dbname;
 
@@ -236,4 +236,22 @@
 	my $comment = $exposure->{comment};
 
+	# This is a hack to fix old exposures that have no object.
+	if ((!defined($object))||($object eq 'NULL')||($object eq '')) {
+	    if ($comment =~ /3pi_/) {
+		$object = $comment;
+		$object =~ s/^.*?(3pi_\d\d_\d\d\d\d).*?$/$1/;
+	    }
+	    elsif ($comment =~ / ps1_/) {
+		$object = $comment;
+		$object =~ s/^.*?(ps1_\d\d_\d\d\d\d).*$/$1/;
+	    }
+	    else {
+		$exposure->{data_state} = 'drop';
+		$exposure = update_this_exposure($exposure);
+		next;
+	    }
+	}
+
+
 	if (S64_IS_NOT_NULL($chip_id)) { # We already have a defined chip_id
 	    if (($pairwise) && !($pair_id)) {
@@ -647,5 +665,5 @@
     $command .= " -definebyquery -select_label $label -select_skycell_id ${proj_cell}.% -select_filter $filter ";
     $command .= " -set_label ${label} -set_workdir $workdir -set_data_group ${proj_cell}.final.${date} ";
-    $command .= " -min_num 2 -set_reduction THREEPI_STACK ";
+    $command .= " -min_num 2 -set_reduction THREEPI_STACK -set_dist_group ${label}";
 
     my ($success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
