fix ngram generation