add new connection logic for replset