Changes for sock_wait