Fixed bugs regarding inventory.