Fix toName and explicitly document its guarantees