Added some error checking in case network is down