 Later, at the request of An Sishun, the military governor ("Jiedushi") of Shuofang Circuit (朔方, headquartered in modern Yinchuan, Ningxia), he became An's secretary.In 755, the general An Lushan (An Sishun's stepbrother) rebelled at Fanyang (范陽, in modern Beijing), and by summer 756, the forces of his new state of Yan were approaching the Tang capital Chang'an, forcing Emperor Xuanzong to flee to Chengdu.Emperor Xuanzong's son and crown prince Li Heng, however, did not follow him to Chengdu, but instead considered fleeing to Lingwu (Shuofang Circuit's capital); for the time being, he remained at Pingliang.