Fix socket disconnect problem on logout.