Resolve the buffer access exception of NGramGenerateModel().