adds leader; fix wrong order of setting up listening socket