Fix the issue of possible freezing during disconnection and reconnection