fix serialization of MongoDB client