Backport D2X ancestor sanity check