Statement throws "Cannot read property 'count' of null" when response is null