Added code to check for avaible networks before changing the state to
"not working"