Fixed bugs caused by race condition in auth on replicasets