Index: trunk/PS-IPP-PStamp/lib/PS/IPP/PStamp/Job.pm
===================================================================
--- trunk/PS-IPP-PStamp/lib/PS/IPP/PStamp/Job.pm	(revision 28243)
+++ trunk/PS-IPP-PStamp/lib/PS/IPP/PStamp/Job.pm	(revision 28244)
@@ -475,5 +475,5 @@
     my $inverse = $option_mask & $PSTAMP_SELECT_INVERSE;
 
-    my $command = "$difftool -dbname $imagedb";
+    my $command = "$difftool -dbname $imagedb -pstamp_order";
     
     my $listrun = 0;
@@ -482,6 +482,9 @@
             $command .= " -diffskyfile -diff_id $id -skycell_id $skycell_id";
         } else {
+            $listrun = 1;
             $command .= " -listrun -diff_id $id";
-            $listrun = 1;
+            # the following is a work around for the problem reported in ticket #1394
+            # 'difftool -listrun returns multiple rows for stack-stack diffs'
+            $command .= " -limit 1";
         }
     } else {
@@ -492,5 +495,5 @@
 
     my $n = $output ? scalar @$output : 0;
-    if (!$listrun && ($n > 1)) {
+    if ($n > 1) {
         die ("difftool returned an unexpected number of diffskyfiles: $n");
     } elsif ($n == 0) {
