Fixed type hierarchy logic.