Fixed CURL function and unit test.