update item counter function