Fixed check in inventory when item type is undefined