fixing issues with detecting when disconnected