better handling of nil response