Fix the word count logic