Improved curl_exec wrapper