added check for netowork before making api call