fixed the bug of word counter