make serialize and deserialize functions pluggable