fix the deallocation of dead socket