delete counter.txt file and fix some bugs