Fix error when remove a node without parent