Hillary Clinton is running to be President Barack Obama’s heir, but there’s one aspect of his legacy that she’ll want to avoid imitating: his disastrous performance in the first presidential debate against Mitt Romney in 2012. is remembered as an unmitigated disaster, one that some pundits at the time thought was fatal to Obama’s re-election bid. According to a CNN/Opinion Research poll at the time, 67 percent thought Romney won the debate versus 25 percent who thought Obama came out best. On his blog, Andrew Sullivan wailed, I’ve never seen a candidate self-destruct for no external reason this late in a campaign before... But when a president self-immolates on live TV, and his opponent shines with lies and smiles, and a record number of people watch, it’s hard to see how a president and his party recover.” Sullivan was wrong to be so pessimistic. Obama learned from his mistakes and handily won the subsequent two debates.

Obama’s performance in 2012, both his initial failure and what he learned from it, are pertinent to Clinton. While Mitt Romney and Donald Trump are usually classified as belonging to two radically opposed wings of the Republican Party, they have some salient similarities. Both are Benghazi-obsessed businessmen who present themselves as old-fashioned go-getters who know how to do the job, as against their incompetent Democratic opponents. It’s the appeal to pragmatic business competence that allowed Romney to re-invent himself as a moderate in the first debate even though he had run as a hard-right conservative in the primaries. The big worry among Democrats is that Trump will pull off a similar trick in the first debate, presenting himself on his best behavior so the public forgets about all his earlier antics.

Several lessons can be gleaned from Obama’s failure in the first debate:

1. Be prepared for a slippery opponent. Obama didn’t anticipate that Romney would audaciously try to pass himself off as a genial, Massachusetts-moderate Republican. For the subsequent debates, Obama came prepared with handy soundbites to remind the audience of Romney various liabilities (the “47 percent” recording, opposing the Detroit bailout, calling for self-deportations of immigrants). Clinton has to be similarly ready to remind people why they don’t like Trump.

2. Don’t be so defensive that you get lost in the weeds. As former Obama speechwriter Jon Favreau recalls, Obama went into the first debate with a chip on his shoulder. The president felt that Romney had been lying about Obama’s record and he wanted to set things straight. According to Favreau, Obama “kept asking for more policy briefings. He would speak in wonk and throw out acronyms during prep.” Clinton is by inclination just as much a policy wonk as Obama, and like him she’ll be inclined to be defensive about her record. So it’s imperative to look at the example of Obama’s second and third debates with Romney, where thanks to aids he had learned to avoid the detailed lectures that bogged him down the first time.

3. Accept that debates are not intellectual exercises but political theater. As Favreau notes, “Obama hates debating. The first time I helped him prep, in August of 2007, he couldn’t stop complaining about the phony, gladiatorial nature of these performances, which are often a highly subjective test of style and demeanor over substance and accuracy.” The problem with this sort of attitude is that it cedes the stage to those who gleefully accept that debates are performances. And there’s no bigger political showman than Trump himself. In order to improve his debating style, Obama had to give up the illusion that he and Romney were there to thrash out competing philosophies of government. The purpose of a debate is to forcefully push your talking points, even if that means ignoring your opponent’s points.

4. Don’t panic. Perhaps the greatest lesson Obama offered in 2012 was the value of remaining resolute. Even as supporters like Andrew Sullivan were in meltdown mode, Obama didn’t let his poor showing in the fist debate demoralize him. He figured out what went wrong the first time and improved his game. Even if Clinton botches tonight, she has two more cracks at bat.