Fixed bugs in Inventory and Inventory Test