Fixed bug that occurred when disconnecting