add tests for MongoObject and fix some issues found by the tests