Added some error handling for when there is no network and such