Fixed endless loop of expansion and reduction of hierarchy.