Fixed issues with managing connection losses. Still a bug where connection lost doesn't notify user.