fixed counter bugs.