fix some bug on disconnection