fix and optimize configuration() and to_uri() use of alter()