SERVER-5689, fix and associated tests