serialize: added sync option to the serialize block