Partial fixes for #1956: avoid using generic inner function names in decorators.