add error handling for successful but malformed output