fix core when top tree's setNumNodes
tried to allocate too many nodes.