fixed counter update bug