Best effort fix for Mongo's bugs

See #851