Re: wifi problem
Welcome to Android Central! Which device? Were you using the device at the time, or was it asleep when the wi-fi turned off?
Go to Settings>Wi-fi, tap Menu>Advanced, and make sure the option to keep wi-fi on while asleep is on. Also turn off any wi-fi optimization settings, because that's to optimize battery, not wi-fi reception.