fix bugs preventing invoice creation