updated viewDidLoad to check network reachability