Null pointer in links

I had a case where JSON object returned from API had a links parameter that is null. It took me a while to figure out the problem.

This commits should fix this problem and improve logging if error happens during parsing of result.