DETROIT (AP) — Ford Motor Co. reversed a loss and rode some big accounting changes to post a $17.94 billion net profit last year, even as it battled computer chip shortages that caused factory slowdowns and vehicle shortages.

U.S. sales for the Dearborn, Michigan, automaker fell 7% for the year over depressed 2020 numbers. But customers paid record prices of nearly $51,000 per vehicle in Ford’s most lucrative market, according to Edmunds.com.

Excluding the one-time items such as the $8.2 billion reclassificaton of Ford’s investment in electric vehicle startup Rivian, the company made $1.59 per share, falling short of analyst estimates of $1.86, according to FactSet. Revenue rose 7.2% to $136.34 billion. That was short of analyst estimates of $137.61 billion.

The company said it expects full-year pretax profits this year to rise 15% to 25% over 2021 numbers, to a range of $11.5 billion to $12.5 billion.

Chief Financial Officer John Lawler said Ford is seeing high demand for its products, but its factory output was constrained last year by the semiconductor chip shortage and other supply-chain disruptions.

The problems cost Ford about 250,000 vehicles of production last year, Lawler said.

“It’s the supply chains that limit what we could produce, what we could provide,” he told reporters Thursday.

He said he sees production improving this year, with a slow start in the first quarter. Ford expects sales to dealers to rise 10% to 15% over the 3.9 million last year.

But Lawler warned that Ford faced increased commodity costs for materials such as aluminum, steel, precious metals and resins. Those costs increased $3 billion last year, and Ford sees them rising another $1.5 billion to $2 billion this year.

“That is one of our key headwinds that we’re working through,” he said. “It’s pretty much across the board on all of our commodities.”

Ford’s net income reversed a loss of $1.28 billion last year as it also dealt with a huge restructuring, a costly recall and a decline in the value of its pension fund.

The company’s stock fell 4.2% in after-hours trading largely because it missed Wall Street estimates. Before the earnings report, it had fallen 3.6% during Thursday’s regular trading hours.

Lawler said the company should be judged on its earnings increase and increased full-year guidance.

“You have to look at the long term and you have to look at the trajectory of the company,” he said.

For the fourth quarter, Ford made $12.28 billion, or 26 cents per share excluding one-time items. That was short of Wall Street estimates of 45 cents per share.

Based on the company’s performance, members of the United Auto Workers Union at Ford will get profit-sharing checks this year of $7,377, the company said.