Fix bug in connection with custom grammars.