fix bug for disconnect