Bug fix: curl_exec called twice