fixed some resetting of counters