Fixed the serialize of function
Merge branch 'feature/allow-function-serialization'