Fix bugs in node or tran cmp. Fix bugs in support

Bugs in previous node and tran cmp making some sort unstable.
Bugs in previous generalization support attribute may count parent nodes
as leaf node.s