Applied previous fix to the second invoices query as well.