Fixed using a nil local variable when an instance variable should be used
Change to use an automatic wifi connected logic