fix ancestor checking