Fix index search when there are parent elements around table