bug fixes for newer mongo versions