fixes for error handling with mongo