add check for connection function