Grammar parsing fixes