More refactoring, fix database selection in MNGObject.