Fix bug where reordering tree does not preserve original parent.

Not preserving original parent can confuse code that depends on this
check to do other things.