Show the address hierarachy levels in the right order

The manage address hierarchy page was not ordering the hierarchy level by the level. The hierarchy set up by upload shows up fine. But if you insert an intermediate level using sql script, it used to show up at the bottom of the list.