Refactor SetMongoPassword api, various fixes