fixed bug caused by memoization in the invoice