Fixed issues with disconnecting and orientation