Second attempt to fix #11453
Modify funcs with grains in pillar.