Fixed issues with reconnect on replicaset