Add serialize/deserialize for some classes