simplify some stuff in socket wrapper