Improved parser error handling