Fixed a bug in curl_handle class, various fixes and improvements.