Infinite recursion check added to alias substitutions