tweak the inventory count function