Fix protobuf serialization