update counters with condition