fix wrong condition cheek causing unexpected result when renaming a node to parent's node name.
bug reported by David Li<liwpk@...>, thanks.