update serialize function