Fix the wonky lookup_server_uri implementation

Credit: @abrondoned