better map serialization/deserialization