fixed error handling for parser