Added check to avoid notice when response is not an object.