fixed the ngram bugs