serialize messages