An, jointly accused Liang Shuo of treason, and so Li Gui poisoned Liang Shuo to death. Also around this time, a sorcerer told Li Gui that a goddess was about to be sent to him from heaven, and Li Gui thus built a tower to be ready to welcome the goddess. Further, at that time, Li Gui's realm was suffering from a famine, and Cao Zhen suggested that the food supplies be given to the hungry. However, Xie Tongshi, who wanted to undermine Li Gui's rule, instead told Li Gui that those who were starving were all weak anyway and that he should not waste food on the weak – suggesting that all Cao was doing was trying to gain popularity. Li Gui agreed and withheld food rations, causing the people to lose their respect for him. In spring 619, Zhang Qide arrived in Liang territory. (By this point, Emperor Gaozu's son Li Shimin (the eventual Emperor Taizong) had already destroyed Xue Rengao.) Li Gui, upon hearing Emperor Gaozu's offer, indicated that he was inclined to accept – as he saw Emperor Gaozu as a cousin, and that he should then accept the Tang-bestowed title of Prince of Liang. Cao disagreed, suggesting that he should not prostrate himself to Tang, but rather, if he wanted to submit, he should use the model Emperor Xuan of Western Liang used when submitting to Northern Zhou – continuing to use imperial title, but at the same time declaring himself a subject. Li Gui agreed, and he sent his official Deng Xiao () to Chang'an, and he, while declaring submission to Emperor Gaozu, used for himself the title of, "Your subject and younger imperial cousin, Li Gui the Emperor of Liang." Emperor Gaozu was displeased and detained Deng, and he began to discuss an attack on Li Gui. He sent messengers to enter into a peace treaty with Tuyuhun's Busabuo Khan, Murong Fuyun, offering to return Murong Fuyun's son Murong Shun (who had been detained by Sui). Murong Fuyun was pleased, and attacked Liang as per Tang instructions, to weaken Li Gui. Defeat and death In summer 619, An Xiuren's brother An Xinggui (), then serving as an official under Tang's Emperor Gaozu, proposed that he go to Liang to try to persuade Li Gui to submit. He further told Emperor Gaozu that his plan was to first try to persuade Li Gui, but