fix bug on disconnect