socket: fix disconnect bug