Boeing [BA] on Wednesday reported lower losses in its first quarter versus a year ago as operating losses in its defense and commercial aircraft segments narrowed while sales were strong across the board, led by increased passenger plane deliveries.

The net loss in the quarter was $425 million, 69 cents earnings per share (EPS), versus a $1.2 billion ($2.06 EPS) loss a year ago. The core operating loss, which excludes pension adjustments, was $1.27 EPS, 23 cents worse than consensus estimates.

The Defense, Space & Security segment suffered from a $245 million pre-tax charge on the Air Force’s KC-46A aerial refueling tanker program. Boeing in March disclosed the charge, but not the amount, which was related to a supplier quality issue for the center fuel tank.

“The good news is we understand it and we’re progressing through that rework,” Dave Calhoun, Boeing’s president and CEO, said on the company’s earnings call.

Sales increased 28 percent to $17.9 billion from $14 billion a year ago led by a surge of aircraft deliveries in Commercial Airplanes and a 19 percent top-line gain at Defense, Space & Security, in large part due to a $2.6 billion contract in January for nine new KC-46 aircraft and program milestone completions, Brian West, the company’s chief financial officer, said on the call.

West said 60 percent of defense sales in the quarter were on programs that combined delivered double-digit margins and 15 percent are from fixed-price-development programs. The rest of the sales are from “a small number of established programs that are experiencing negative margins on certain contracts due to specific near-term supply chain and factory stability pressures that we’ve highlighted previously,” he said. As the year progresses, these programs are expected to improve and “return to normal margin levels over time,” he added.

Boeing Global Services also turned in strong sales, up 9 percent, on commercial work and the segment posted a handsome 34 percent increase in operating income on commercial and government business.

Free cash was a $786 million outflow in the quarter but the company still expects to generate between $3 billion and $5 billion in free cash flow this year, the second straight year of positive cash flow. Boeing suffered three straight years—2019 through 2021—of negative cash flow largely due to problems related to fixing issues on its 737 MAX aircraft.

The forecast for free cash flow is driven by performance at Commercial Airplanes and Global Services, which combined will more than offset a $500 million to $1 billion headwind at Defense, Space & Security.

Backlog at the end of the quarter was $411 billion, with defense accounting for $58.2 billion, up 7 percent from $54.4 billion at the end of 2022. The defense business booked $10 billion in orders in the quarter.