debugged check_internet() function