things?" He invited Xie and Wei to join his administration. The Western Tujue general Ashina Kandu (), claiming the title of Kan Khan (), also submitted to him. Soon, Xue sent his general Chang Zhongxing () to cross the Yellow River to attack Li Gui. Li Gui sent Li Yun to resist Chang, and Li Yun defeated Chang and captured all of his army. Li Gui wanted to release Chang's soldiers, but Li Yun opposed, believing that they would flee back to Xue and attack again; rather, Li Yun proposed that they all be slaughtered. Li Gui responded, "If Heaven protects me, I will eventually capture their leader, and they will all be mine. if Heaven does not protect me, it is useless for me to keep them." He therefore released them. Li Gui soon took four other commanderies – Zhangye (張掖, roughly modern Zhangye, Gansu), Dunhuang (敦煌, roughly modern Dunhuang, Gansu), Xiping (西平, roughly modern Xining, Qinghai), and Fuhan (枹罕, roughly modern Linxia, Gansu), controlling the territory west of the Yellow River. Soon, however, Ashina Kandu rebelled, but Li Gui was able to defeat and destroy him. Meanwhile, Emperor Gaozu of Tang, who had established the Tang dynasty in spring 618 and wanted to enter an alliance with Li Gui to attack Xue Ju's successor Xue Rengao, sent messengers to Li Gui, calling him "younger cousin." Li Gui was pleased, and he sent his brother Li Mao () to the Tang capital Chang'an to greet Emperor Gaozu. Emperor Gaozu, in response, sent his official Zhang Qide () to Wuwei to commission Li Gui as the commandant of Liang Prefecture (i.e., Wuwei) and created him the Prince of Liang. Before Zhang could arrive at Li Gui's domain, however, Li claimed imperial title (as the Emperor of Liang) in winter 618. He created his son Li Boyu () as crown prince. As emperor Once Li Gui claimed imperial title, however, his governance appeared to deteriorate. He initially trusted Liang Shuo, whom he regarded as intelligent, as his chief strategist. However, as Liang Shuo realized that the Xiongnu chiefs were becoming increasingly powerful, he advised Li Gui to curb their powers, and so made an enemy out of An Xiuren, who was the leader of the Xiongnu chiefs. Further, when Li Gui's son Li Zhongyan () visited Liang Shuo, Liang Shuo did not respect him, and so Li Zhongyan, displeased, along with