possible fix for findSubstitution stack overflow, which does not break additional unit tests