a better fix for word count bug