Fix top_words index out of range problem.