clean up serialization logic