Default `serialize` implementation (Fix #358)