adding checks for circular inheritance