hierarchy_minimize(): Fix NameError when the caller supplies a hierarchy that is missing the top level