Wip mds coverity

Fix a couple coverity issues in the MDS.