Fixed check on ancestors value