Fixed issue with malformed JSON responses