Boeing [BA] on Wednesday posted dramatically wider losses in its fourth quarter and full year on a bevy of charges, mainly related to its commercial aircraft programs, but the defense segment partially offset declines elsewhere.

Most of the approximately $8 billion in charges stemmed from the 777X widebody passenger aircraft program, which took a $6.5 billion hit due to changes to market demand and timing of deliveries, changes in production rates and initial accounting quantities, and delays due to design modifications.

Boeing also suffered a $744 million charge related to a recently announced settlement with the Justice Department over the government’s investigation into the 737 MAX passenger aircraft. The 737 program also was hit by $468 million in abnormal production costs.

Other provisions include a $290 million charge in commercial services related to COVID-19 impacts and $275 million on the Air Force KC-46A aerial refueling tanker program for production inefficiencies and COVID disruptions.

Despite the KC-46 charge, Boeing’s defense segment still posted a huge gain in operating income to $502 million in the quarter from $34 million a year ago when its space business suffered a $410 million hit related to the failure of an un-crewed Starliner space capsule to reach the proper orbit in a test for NASA.

Boeing attributed the income gains in the Defense, Space & Security segment to performance on multiple programs and the Starliner charge a year ago. Sales in the segment increased 14 percent to $6.8 billion on fighter programs and gains across the portfolio.

Boeing’s net loss in the quarter was $8.4 billion, $14.65 earnings per share (EPS), versus a loss of $1 billion ($1.79 EPS) a year ago. Adjusting for pension impacts, the core EPS loss was $15.25, far worse than consensus estimates of a $1.60 EPS loss.

Sales in the quarter tumbled 15 percent to $15.3 billion from $17.9 billion a year ago.

The Commercial Airplanes segment drove the declines at the company with sales down on fewer aircraft deliveries related to COVID impacts on widebody jet demand and production issues on the 787 passenger plane. Losses widened on the various charges.

The Global Services segment also tanked due to the weak commercial demand related to COVID impacts worldwide. Operating income was down nearly 80 percent and revenue off 20 percent.

Dave Calhoun, Boeing’s president and CEO, said on the company’s earnings call that the defense segment combined with the defense portion of the Global Services segment are providing some “stability” for Boeing amid the commercial challenges.

In 2020, Boeing’s losses widened to $11.9 billion ($20.88 EPS) from $636 million ($1.12 EPS) in 2019. Sales fell 24 percent to $58.2 billion from $76.6 billion.

At the end of 2020, the Defense, Space & Security segment stood as Boeing’s largest with $26.3 billion in sales followed by the venerable Commercial Airplanes business with $16.2 billion and Global Services with $15.5 billion.

Free cash for the quarter and year was an outflow of $4.3 billion and $19.7 billion, respectively.

Boeing hasn’t been providing financial guidance for more than a year but in its earnings presentation offered “key drivers” for 2021.

Modest growth is forecast in the defense segment and services are projected to be stable. Sales will also improve in the commercial segment as deliveries of 737 and 787 planes pick up.

Boeing is also forecasting an improvement in profitability this year due to higher commercial aircraft deliveries, an absence of the 2020 charges, improved performance, and business transformation actions that include job reductions and consolidations. The company also expects operating cash flow to improve in 2021.

Total backlog at the end of 2020 stood at $363.4 billion, down a whopping $100 billion from a year ago. Defense segment backlog stood at $60.8 billion, down 5 percent from $63.7 billion a year ago.