Fixed code in accordance with changes in JSON API.