Bunch of fixes for peer/connect