add doctest showing but in applySubst and add more traces