diff --git a/scripts/rt-outreachy-payment-next.plx b/scripts/rt-outreachy-payment-next.plx
index 81d2715..d04631a 100755
--- a/scripts/rt-outreachy-payment-next.plx
+++ b/scripts/rt-outreachy-payment-next.plx
@@ -169,12 +169,6 @@ while (my $file = readdir $dh) {
     next;
   }
 
-  # Find the ticket number for this intern.
-  my $entity = LedgerTagFromTicket($ticket, 'Entity');
-  if (not defined $entity) {
-    print STDERR "\"$file\": \"$ticket\": Skipping: cannot determine Entity from ticket." ;
-    next;
-  }
   my(@nameComponents) = split(/\s*-\s*/, $name);
   my(@searchTerms);
   foreach my $name (@nameComponents) {
@@ -196,7 +190,14 @@ while (my $file = readdir $dh) {
       die "interactive mode not yet supported";
     }
   }
-  if ($PAYMENT_NUMBER == 1) {
+  # Find the ticket number for this intern.
+  my $entity = LedgerTagFromTicket($ticket, 'Entity');
+  if (not defined $entity) {
+    print STDERR "\"$file\": \"$ticket\": Skipping: cannot determine Entity from ticket." ;
+    next;
+  }
+
+  if ($PAYMENT_NUMBER <= 1) {
     print STDERR "Sorry, script does not yet support first payment\n";
     exit 1;
   }