Li Jiancheng
In 626, Li Shimin the Prince of Qin, then in an intense rivalry with Li Jiancheng and fearing that Li Jiancheng would kill him, ambushed Li Jiancheng and another brother who supported Li Jiancheng, Li Yuanji the Prince of Qi, at Xuanwu Gate and killed them. After Li Jiancheng's and Li Yuanji's deaths, their troops nevertheless continued to battle Li Shimin's, and Li Shimin asked Pei to appear before them and encourage them to disband, which they did. When Li Shimin then effectively forced Emperor Gaozu to create him crown prince and then reorganized the government, Pei was made the minister of census.