Fix function persist
Add references in config namespace
Add option to save diff in function persist