Fix mongoreading and encoding