Fix exited socket bug