fixed bug when disconnecting viewer