Make modFuncs work with stateful functions.