fixed bugs resulted from refactoring nlp