Fixed curl error handling.