In the winter of 217, the warlord Liu Bei sent Zhang Fei, Ma Chao, Wu Lan (吳蘭) and others to garrison at Xiabian County (下辯縣; northwest of present-day Cheng County, Gansu) in preparation for an invasion of Hanzhong Commandery, which Cao Cao had seized from the warlord Zhang Lu after the Battle of Yangping in 215. Cao Cao ordered Cao Hong to lead forces to resist the enemy, with Cao Xiu serving as Cao Hong's adviser. Cao Cao had told Cao Xiu, "You may be an adviser, but you're actually the commander." When Cao Hong received the order, he delegated his command to Cao Xiu. Cao Hong heeded Cao Xiu's advice and defeated Wu Lan in the spring of 218 and killed Wu's deputy, Ren Kui (任夔). Wu Lan was slain by Qiangduan (強端), a Di chieftain from Yinping (陰平). Zhang Fei was forced to retreat.