There was an error in Invoices class, leading to an undefined result if the user was not in the invoice.