modify FA and grammar