fixed bugs for handling keyword not found