New York CNN — Boeing reported a $650 million operating loss in the fourth quarter, surprising Wall Street analysts who had expected the aircraft giant to turn a profit. The company blamed the unexpected loss on “abnormal production costs” as it tried both to deliver the remaining backlog of 737 Max jets and to step up deliveries of the 787 Dreamliners. The company’s production of the 787 remains below normal rates. What’s more, Boeing had to shell out an unspecified amount of compensation to 787 customers whose deliveries were delayed by about a year. Boeing has reported only two profitable quarters in the nearly four years since the grounding of the 737 Max. After two fatal crashes that killed 346 people, the jet was grounded for 20 months starting in March 2019. Then a year later, the pandemic brought demand for flying and new aircraft to a near halt — sparking the cancellation of hundreds of jet orders and the pileup of losses for Boeing. Still, the industry has shown signs of picking up, and analysts surveyed by Refinitiv had forecast that Boeing would earn 26 cents a share. Instead it reported a loss of $1.75 a share. So while that’s an improvement from the loss of $7.69 a share in the fourth quarter of 2021, it’s also a big disappointment. Boeing’s problems in the fourth quarter are tied to its difficult few years since the 737 Max crisis. For one, the company was saddled with excess inventory of hundreds of the jets. Usually Boeing doesn’t hold onto inventory, as plans are delivered to customers soon after completion. But even though the 737 Max jets couldn’t be delivered during the grounding, Boeing kept building them—partly to keep its suppliers in business. Then it was forced to find new buyers for some of those plans due to customers canceling orders during the pandemic. Beyond the Max, the FAA flagged quality problems with the company’s 787 Dreamliners that stopped it from delivering that model. Though the Dreamliner was not grounded like the Max, it still affected the company: Much of Boeing’s abnormal production costs last quarter were a result of having to rework both the Max and Dreamliner jets, CEO Dave Calhoun said in an interview on CNBC Wednesday. The supply chain problems are improving, Calhoun added, but they are not behind the company or the aerospace industry as a whole, He suggested more money-losing quarters may be ahead despite a rebound in demand, saying he expects Boeing to have “bouncy” margins throughout the year as its Max and Dreamliner inventories are cleared. Boeing delivered 152 commercial jets in the quarter, up 54% from a year ago and better than its own target. But digging deeper into the financial results highlights a potential problem: It appears Boeing received lower prices on some of its plans than analysts had expected. That’s because the company’s revenue fell short of forecasts, coming in at just below $20 billion. While it was Boeing’s highest revenue figure since the start of the pandemic, it was about $360 million less than analysts’ consensus estimate. The combination of better-than-expected deliveries but worse-than-forecast revenue suggests that weaker pricing. Boeing tried to put the best spin possible on its disappointing results. The company pointed out that this was the first full year of positive operating cash flow since the start of the 737 Max crisis. Boeing finally brought in $3.5 billion more cash than it spent, and the company reaffirmed its guidance for 2023 of positive operating cash flow of between $4.5 billion to $6.5 billion. “Demand across our portfolio is strong, and we remain focused on driving stability in our operations and within the supply chain to meet our commitments in 2023 and beyond,” Calhoun said in the company’s statement. “While challenges remain, we are well positioned and are on the right path to restoring our operational and financial strength.” Shares of Boeing (BA) were down 2.5% in morning trading.