fix wrong index on ancestors