Port a fix from the mongo driver.
Merge branch 'master' into horde_5_2