Bug fix in createInvoice