Lowly rated U.S. energy companies that struggled for survival last year are finding renewed optimism among investors after a surge in oil prices, helping them raise a record amount of debt to fend off bankruptcy.

Energy and power companies tracked by Refinitiv have raised more than $20 billion in the high-yield bond market so far this year, an all-time record for data going back to 1996.

A four-month-long rally in crude prices stalled last week, but Brent, the international benchmark, remains above $60/bbl, up over 60% since the start of November. This rally, fuelled by vaccine rollouts and record OPEC oil production cuts, has prompted a change in sentiment among debt investors who had shunned many energy companies last year.

“At these levels, a lot of companies can hedge future production and survive,” said John Dixon, a high-yield bond trader at Dinosaur Financial Group. “It’s the oil-linked names in high yield that have been among the best performers recently.”

Last year’s oil crash—which briefly pulled U.S. prices below zero—caused deep distress in the American energy business, where operators slashed planned spending, sacked tens of thousands of workers, and even shut down some wells.

Haynes and Boone, a law firm, said more than 100 U.S. oil and gas producers and services companies went bankrupt last year, accounting for more than $108 billion in debt.

Among them was Chesapeake Energy Corp., a pioneer of the shale revolution, whose collapse symbolized the crisis for an industry that blew through around $400 billion of external capital during a decade-long drilling boom that made the U.S. the world’s biggest oil and gas producer.

At the start of February this year, Chesapeake raised two bonds to fund its emergence from bankruptcy, worth a combined $1 billion, both with coupons under 6%. It has been joined by higher rated Murphy Oil Corp. and Diamondback Energy Inc., which have both issued debt in March.

Even lower-rated energy companies have been able to raise cash. CGG SA, which produces imaging software for use in oil exploration and carries one of the lowest ratings of triple-C plus, raised $500 million last week at a coupon of 8.75%. Similarly, lowly rated Shelf Drilling Ltd., a rig provider to shallow-water drillers, raised $310 million at a coupon of 8.875%.

Renewed optimism has also helped drag the value of existing bonds back from the brink. Offshore drilling company Transocean Ltd.’s seven-year bond raised last year has risen to 87 cents on the dollar from as low as 31 cents in October.

At its emergence from bankruptcy in February, Chesapeake joined other shale operators in saying a new era of slower production growth was under way and producers would now prioritize shareholder returns and debt repayment in a bid to prise open capital markets again.

Rystad Energy, a research company, said more than $170 billion worth of shale company debt was scheduled to mature over the next five years, and another $90 billion after.

Some investors have urged caution, noting a longer-term shift towards more renewable energy sources.

“Traditional energy companies are trying to get through by greenwashing and telling people they are not that bad or that they are getting better,” said John McClain, a portfolio manager at Diamond Hill Capital management. “From our perspective, it does not make sense to buy in until we see concrete change.”

In January, S&P Global Ratings cited an accelerating energy transition to clean fuels as it increased its oil and gas industry risk assessment to “moderately high” from intermediate.

“It makes sense that energy issuers would try to tap into a robust high yield market, especially given the revival in oil prices,” said Matt Eagan, a portfolio manager at Loomis Sayles. “I guess, hope springs eternal in the energy sector; however, ESG trends do not bode well for the sector longer term.”