more error handling for parsing