Index: trunk/PS-IPP-PStamp/lib/PS/IPP/PStamp/Job.pm
===================================================================
--- trunk/PS-IPP-PStamp/lib/PS/IPP/PStamp/Job.pm	(revision 27851)
+++ trunk/PS-IPP-PStamp/lib/PS/IPP/PStamp/Job.pm	(revision 27852)
@@ -457,15 +457,20 @@
     my $command = "$difftool -dbname $imagedb";
     
+    my $listrun = 0;
     if ($byid) {
-        $command .= " -listrun -diff_id $id";
+        if ($skycell_id) {
+            $command .= " -diffskyfile -diff_id $id -skycell_id $skycell_id";
+        } else {
+            $command .= " -listrun -diff_id $id";
+            $listrun = 1;
+        }
     } else {
         $command .= " -diffskyfile -diff_skyfile_id $id";
     }
-    $command .= " -skycell_id $skycell_id" if $skycell_id;
 
     my $output = runToolAndParse($command, $verbose);
 
-    my $n = @$output;
-    if (!$byid && ($n > 1)) {
+    my $n = $output ? scalar @$output : 0;
+    if (!$listrun && ($n > 1)) {
         die ("difftool returned an unexpected number of diffskyfiles: $n");
     } elsif ($n == 0) {
@@ -474,5 +479,5 @@
 
     my $images;
-    if ($byid) {
+    if ($listrun) {
         $images = selectComponents($ipprc, $imagedb, 'byid', 'diff', $rowList, $output, $verbose);
     } else {
