Sentinel: various fixes to leader election implementation.