Properly compute Realm URI, close #626