moved serialize fns to util