porting invoices.sql to 1.4
more fixes