Boeing [BA] on July 27 reported a net loss in its second quarter as expected stemming from more than $2 billion in charges announced the week of July 18 across several programs while the world’s largest aerospace and defense contractor managed to eke out a small sales gain on the strength of its commercial aircraft business.

Sales in the quarter increased a percent to $24.8 billion from $24.5 billion a year ago. Net income swung to a $234 million loss, 37 cents earnings per share (EPS), versus income of $1.1 billion ($1.59 EPS) a year ago. Boeing on the week of July 18 announced $2.1 billion ($3.23 EPS) in charges related to its 787 and 747 commercial aircraft programs and the Air Force’s KC-46 aerial refueling tanker.

The charges were partially offset by improved operating performance and lower taxes.

Excluding certain pension expenses, core operating losses in the quarter were $488 million (44 cents EPS), far better than the 92 cents EPS loss that analysts had forecasted. The company’s per share results also benefited from a lower share count due share repurchases.

To account for the charges, improved operating performance and lower taxes, Boeing lowered its outlook for earnings in 2016 to between $6.40 and $6.60 EPS from the prior outlook of between $8.45 and $8.65 EPS. Core earnings are projected to be between $6.10 and $6.30.

At the segment level, sales at Boeing’s Defense, Space & Security sector were down 5 percent to $7.2 billion on lower C-17 transport and Chinook helicopter deliveries, and a decline in business at the Network & Space Systems (N&SS) division.

Dennis Muilenburg, Boeing’s chairman, president and CEO, said on the earnings call that 29 percent of defense sales were from international customers. International demand remains “healthy,” he said.

Operating income in the segment was up 9 percent to $593 million, reflecting gains at Military Aircraft and N&SS.

Muilenburg said the company is expecting “modest growth” in defense spending by the Department of Defense over the next five years.

Boeing Commercial Aircraft recorded a 3 percent increase in sales to $17.5 billion on two additional aircraft deliveries, 199 in total, and higher service revenue. The segment swung to a $973 million operating loss on the program charges.

Backlog in the commercial segment stood at $417 billion and at $55 billion in the defense business, of which 37 percent represents orders from international customers. Free cash flow was $2.6 billion.

Muilenburg said demand remains “healthy” in the commercial aircraft market as commercial airline traffic globally is outstripping gross domestic product although weakness continues in the air cargo market. He also said the company’s services businesses across the commercial and defense portfolios has plenty of opportunities to grow, including the traditional parts, services and upgrade programs but also in data analytics.