Fixed finding elements that were outside the current element tree. For