Pass replacements by reference and rename function.
Fix function check.
Merge branch '4.0'