[Editor’s note: Opinions expressed by the author are their own.]

The collapse in crude prices this year has sent activity among U.S. oil and gas producers tumbling and left more than 100,000 workers out of a job.

But for one small handful of employees things are not looking so bad.

As their companies approach bankruptcy, executives at failing oil and gas producers have awarded themselves tens of millions of dollars in bonuses. And even in an industry that is no stranger to excess, investors have had enough.

Whiting Petroleum Corp., the sector’s first big casualty in the wake of the crash, paid five executives $14.6 million as it filed for Chapter 11 bankruptcy protection in April. Extraction Oil & Gas Inc., the second big name to go, handed 16 executives $6.7 million this month—a week before it sought protection.

Perhaps most egregious was Chesapeake Energy Corp., which is expected to join the list of casualties imminently. Last month the company paid 21 executives $25 million.

California Resources Corp., also on the brink, tweaked its compensation structure in March so that its CEO would get a severance package worth double his salary and bonus if he is sacked without cause. He earned $10.5 million last year.

None of the companies responded to requests for comment.

Oil companies are not the only ones paying out hefty bonuses to executives as they approach bankruptcy: JCPenney and Hertz have done likewise. The argument goes that to emerge successfully from restructuring you need to keep the people who know how to run the show. Without the bonuses, management could walk.

But investors say the payouts in the energy industry are symptomatic of wider problems with governance and oversight in the sector, where executives have accumulated big pay packets for years despite generally poor share price performance.

“Corporate governance in the [exploration and production] world has historically been atrocious and it continues to be atrocious,” said Ben Dell, managing partner at Kimmeridge, a private equity company with shale assets. “It is the definition of ‘heads I win, tails you lose’. Management gets paid when the share price goes up, when the share price goes down and when the company goes bankrupt.”

CEOs at large independent producers earned 138% of their target bonus pay over the past three years—suggesting they outperformed their agreed goals—according to research by Evercore. Yet over that period total returns to shareholders fell 55%.

Energy companies largely judge their performance against a handful of peers in the sector, allowing them to outperform targets on a relative basis even as overall returns slide. This has knocked the attractiveness of investing in the sector as a whole, analysts say.

Brad Holly, CEO of Denver-based Whiting, received a bonus of $6.4 million as the company filed for bankruptcy—$1 million more than he got one year earlier. The company’s share price had collapsed 97% in the intervening period.

“People are getting fed up,” said Bill Herbert, an analyst at Simmons Energy, an investment bank. “Since 2016 energy stocks have consistently underperformed the broader market and the oil price. The only people who have made money on energy stocks have been the executives running these companies.”

The sector has been the worst performer on the S&P 500 over the past one-, three-, five- and 10-year periods, according to Evercore, while active fund managers have increasingly steered clear.

The excesses of the industry have waned since the boom days, when former Chesapeake CEO Aubrey McClendon took home more than $100 million in 2008. He was later indicted by the Department of Justice for rigging auctions for land rights.

I think the returns have been so weak for so long that boards are finally looking at this and saying ‘OK, we have to change the way we look at things’
Rob Thummel, senior portfolio manager at Tortoise Capital

Even so, his successor Doug Lawler has received total compensation of $110 million over the past seven years, according to Sentieo, a research house. Over that period, Chesapeake’s equity value slid 99%.

Analysts say there is growing awareness in boardrooms that if energy companies want to attract fresh capital they need to align rewards for executives more closely with shareholders.

“I think the returns have been so weak for so long that boards are finally looking at this and saying ‘OK, we have to change the way we look at things’,” said Rob Thummel, senior portfolio manager at Tortoise Capital in Kansas City, which manages $11 billion in energy-related assets.

But years of underperformance have already scared off many investors. Energy has tumbled from a 14% share of the S&P 500’s market capitalization to 3% over the past decade, according to Evercore.

Until there is evidence of real alignment, companies will have a hard time bringing investors back, Thummel said.

“In years when the shareholders are rewarded then management should be rewarded. But rewarding a management team with a big bonus in a year where their shareholders lose a substantial amount of money seems to be wildly mismatched.”