fix folding of functions from macro substitutions