Fixed the inventory function