Check for NULL.
Fix compilation of the json-c bits.
Fix linking of libcurl.