Fix serialization/deserialization mixup