added ambiguous grammar checking