Boeing [BA] on Wednesday reported dramatically wider losses in its third quarter primarily driven by difficulties across a number of its defense programs stemming largely from continued supply chain and labor availability woes while losses in its commercial airplane making business narrowed slightly.

There was one big bright spot in the company’s results. Free cash flow was $2.9 billion, the first time it was positive in several years and company executives said Boeing remains on track to be free cash flow positive this year.

Boeing suffered losses of $2.8 billion on various fixed-price development programs in the defense business, including the KC-46A aerial refueling tanker, the VC-25B presidential transport, MQ-25B aerial refueling drone, T-7A jet trainer, and NASA’s Commercial Crew program. The majority of the losses stemmed from the KC-46, $1.2 billion, and the VC-25, $766 million, Brian West, Boeing’s chief financial officer, said on the company’s earnings call.

West described two drivers for the latest KC-46 charge, one being persistent parts shortages that aren’t expected to abate soon, and “labor instability,” which is also forecast to continue.

As for the VC-25, he said labor issues are “magnified” given the need for workers on the program to have security clearances, which has contributed to schedule shifts.

The MQ-25, T-7 and Commercial Crew programs are suffering from supply chain and labor issues, and also from typical development challenges, West said.

Boeing believes it has largely de-risked the KC-46 and VC-25 programs for the next two years and for other programs even longer, he said.

Dave Calhoun, Boeing’s president and CEO, said on the call that the company remains confident that its development programs will have long-term success and contribute to cash flow.

Supply chain challenges are expected to continue through 2023 despite strong demand across the company’s product portfolio, Calhoun said. Supply chain and labor issues are impacting the entire aerospace and defense industry.

To date, Boeing has taken total program charges of about $6.9 billion on the KC-46, $2 billion on the VC-25, $1.1 billion on the T-7, $1 billion on the MQ-25, and $1.2 billion on Commercial Crew.

Boeing’s Commercial Airplanes segment wasn’t immune to the supply chain issues, which the company said are especially related to its suppliers’ ability to deliver aircraft engines. The engine supply is restricting Boeing’s ability to ramp up production rates on its 737 aircraft, although the pace is expected to pick up throughout 2023, West said.

Boeing’s net loss in the quarter was $3.3 billion, $5.49 earnings per share (EPS), versus a loss of $132 million (19 cents EPS) a year ago. Adjusting for pension costs and benefits, core earnings in the quarter were a $6.18 EPS loss versus a 60 cents EPS loss a year ago. The consensus viewpoint of analysts was for a core EPS profit of 13 cents.

Sales increased 14 percent to $16 billion from $15.3 billion a year ago, driven by higher commercial aircraft deliveries and solid gains in the company’s services segment, which benefitted from the continuing recovery in the commercial aerospace market. The higher commercial sales more than offset a 20 percent drop in revenue at the Defense, Space & Security segment to $5.3 billion due to the losses on various contracts.

The defense segment posted a $2.8 billion operating loss versus a profit of $436 million a year ago.

For now, free cash flow is Boeing’s primary financial metric and the positive cash is being used to lower the company’s debt to help it maintain an investment grade rating, West said. Free cash so far in 2022 is an outflow of $841 million.

Backlog at the end of the third quarter stood at $381.3 billion, up a percent from $377.5 billion at the end of 2021. Defense backlog stands at $54.7 billion, down nearly 9 percent from $59.8 billion at the end of 2021. International business accounts for 31 percent of the defense backlog.

Boeing hasn’t provided financial guidance for several years following difficulties the company’s Commercial Airplanes segment faced due to two tragic crashes of its 737 MAX passenger jet. Calhoun said Boeing will provide “some guideposts for the forward look” at an investor conference next week.