Fix issue with mongo exception handling