Fixed issue of json decoding in the wrong place