optimize the serialization