added find by grammar and fixed some bugs