It’s been a miserable two years for Boeing [BA] following the fatal crashes of two of its customers’ 737 MAX passenger jets in late 2018 and early 2019, which led to production shutdowns, losses and dramatically reduced sales, not to mention a pandemic that dramatically constrained global air travel and exacerbated its woes, but on Wednesday the company showed it is on the way back, posting strong sales and a profit in the second quarter as it increases aircraft deliveries and passengers in some domestic markets resume flying.

Sales increased 44 percent to $17 billion from $11.8 billion a year ago largely on the back of its Commercial Airplanes segment as the company delivered more aircraft to its customers. The services and defense businesses also reported top line gains.

“While we still have a ways to go before a full rebound, it is encouraging to see the commercial market improving, enabled by continued vaccine distribution and increasing travel demand, particularly in domestic markets,” Dave Calhoun, Boeing’s president and CEO, said in a message to employees posted on the company’s website. “Going forward, we will closely monitor case rates, vaccine distribution, travel protocols and global trade as key indicators for recovery.”

Calhoun said 2021 is proving to be an “inflection point” in its recovery.

“We are turning a corner and the recover is gaining momentum,” he said on the company’s earnings call.

Boeing reported $567 million in net income, $1 earnings per share (EPS) versus a $2.4 billion ($4.20 EPS) loss a year ago. Excluding various pension adjustments, core earnings were 40 cents EPS versus a $4.79 EPS loss a year ago, well above the 83 cents EPS loss that analysts were forecasting.

Boeing’s defense business generated a 60 percent increase in operating profit to $958 million primarily due to the absence of a charge in its Air Force KC-46A Tanker program that hit earnings a year ago and a favorable contract adjustment on an international program. Margins in the defense segment were up 53 percent to 13.9 percent, and would have still topped 11 percent excluding the contract adjustments.

Defense sales increased 4 percent to $6.9 billion on higher volume on the KC-46A and P-8A Poseidon maritime patrol aircraft.

The commercial airplanes business posted $6 billion in sales, up 268 percent as aircraft deliveries nearly tripled to 79 planes, and a $472 million operating loss versus a $2.8 billion loss a year ago. Boeing is producing 16 737 aircraft a month and plans to ramp up production to 31 a month in early 2022 with gradual increases above that dependent on market demand, including positive developments in trade relations between the U.S. and China.

Boeing’s services segment contributed $4.1 billion to the top line, up 17 percent from a year ago due to commercial aerospace demand, and the business swung to a $531 million operating profit from a $672 million loss a year ago, boosted by lower impairment charges, lower severance costs, and the higher sales.

Boeing still isn’t providing financial guidance and the subject didn’t come up on the earnings call. Free cash was a $705 million outflow in the quarter and a $5.6 billion outflow through the first half of 2021, but the company still expects to be cash flow positive in 2022.

Overall backlog at the end of the quarter stood at $363.5 billion, essentially unchanged since the end of 2020. Defense backlog stood at $58.7 billion, down nearly 4 percent from $60.8 billion at the end of 2020. Boeing said 32 percent of the defense backlog is from international orders.