fixed a counter reset bug, v0.97b