Added null reference check to RestClient constructor