test serialize and deserialize