 He later served as the commandant at Ling Prefecture (靈州, roughly modern Yinchuan, Ningxia), and then was summoned back to Chang'an to serve as minister of defense.He was serving in that post as of 646, when he was sent to negotiate the surrender of Yi'nan's nephew the Yitewushi Khan Duomozhi (with Xueyantuo then in a state of collapse), although apparently before he could arrive, Duomozhi surrendered to the general Li Shiji.After Xueyantuo's collapse, its vassal Huige briefly took over its territory, but Huige itself was severely weakened in 648 when its ruler Yaoluoge Tumidu (藥羅葛吐迷度) was assassinated by his nephew Yaoluoge Wuge (藥羅葛烏紇).