fixes issues with assuming 'err' is set when statusCode is not 200.