Fixed disconnecting twice bug