calling checkConnection function