Stopped an infinite loop where a class had itself as a substitution