Some further tweaks around socket initialization