Fixes for inventory average costing calculations