on those of Emperor Guangwu of Han, but lacked Emperor Guangwu's military command abilities, and therefore could not draft proper military plans the way that Emperor Guangwu did. Under Emperor Wen of Song, Zhang Chang helped defeat the Northern Wei invasion of Pengcheng. In 452, after hearing that Northern Wei's Emperor Taiwu had been assassinated by his eunuch Zong Ai, Emperor Wen prepared another campaign, with his army commanded by Xiao Xihua—but not realizing that his micromanaging had greatly contributed to the failure of the prior campaign, he made the micromanaging even more complete. After Xiao's assisting general Zhang Yong () was defeated at Qiao'ao, however, he abandoned the campaign. Meanwhile, though, Emperor Wen himself was facing a crisis within his household. It had been discovered that Crown Prince Shao and another son of Emperor Wen's, Liu Jun the Prince of Shixing (a different son than the Liu Jun referred to above), had secretly retained the witch Yan Daoyu () to curse Emperor Wen to death so that Crown Prince Shao could become emperor. Emperor Wen, while angry, only strongly rebuked his sons and was unwilling to take further punitive actions against them. By 453, however, Emperor Wen's hopes that his sons had reformed themselves was shattered—as he found evidence that they continued to associate with Yan even after the rebukes. He therefore discussed with his high-level officials Xu Danzhi, Jiang Dan, and Wang Sengchuo () his planned punishment of deposing Crown Prince Shao and ordering Liu Jun to commit suicide. However, he made the mistakes of discussing the plans with Liu Jun's mother, Consort Pan, and Consort Pan quickly informed Liu Jun, who then informed Crown Prince Shao. In spring 453, Crown Prince Shao carried out a coup, sending his own guards to secure the palace while sending his close associate Zhang Chaozhi () into the palace to assassinate Emperor Wen. When Zhang entered Emperor Wen's bedchambers with a sword, Emperor Wen's guards were asleep, and Emperor Wen tried to hold a small desk to hold off Zhang's attack. Zhang's first swing, however, cut off Emperor Wen's fingers, and he then swung again, killing Emperor Wen. After some confusion, Liu Shao killed Xu and Jiang as well, and then falsely declared that Xu and Jiang had assassinated Emperor Wen; he then took the throne himself, although later that year he was defeated and killed by another brother of his,