Clean up serialization for sharing.