fixed idempotent solution in counter