Fix an infinite loop when two subclasses were subclassof each other.