improved bind_sock