Fix return value in get_hierarchy()