Small improvements to leader state manager and tests