Fixes for replica set primary detection.