fix the mrepo not set bug and add extern method.