detect if the returned data was json and handle errors. fix #18.
Merge branch 'hotfix/parse.json.downloading.chunks'