Fix serialization and deserialization.