Fixed reference types in grammar rules - fixes #410