fixed bug with finding xpath in the case the node has been removed from the tree