Global defaults hit their highest level since the aftermath of the global financial crisis in 2016, according to Moody’s Investors Service Inc.

The credit-rating agency tallied 142 credit defaults in 2016, which is the highest level since 2009. This has been driven largely by turmoil in commodities-related sectors.

Still, despite the high default total for the year, the numbers appear to be on the decline. There were 24 defaults in the fourth quarter, Moody’s reports, down from 27 in third quarter and 51 in the second quarter.

In addition, Moody’s reports that the trailing 12-month global speculative-grade default rate finished the year on a downward trajectory, at 4.4%, down slightly from 4.6% at the end of the third quarter. The firm expects the rate to decline to 3% by the end of this year, which would be well below the historical average of 4.2%.

“The projection of a global speculative grade rate in 2017 well below historical average is buoyed by a combination of narrowing high-yield spreads, as well as manageable maturity and generally healthy liquidity profiles in our spec-grade portfolio,” says Sharon Ou, vice president and senior credit officer at Moody’s, in a statement.

Looking ahead, Moody’s suggests that the default risk for the U.S. oil and gas sector is expected to dissipate in 2017, but that the metals and mining sector “will remain the most challenged” in 2017. In Europe, the retail and oil and gas sectors are expected to see the highest default rates.