refactor counters, fix test