Shell (SHEL.L) said on Thursday said it would reverse up to $4.5 billion in writedowns on oil and gas assets after it raised its energy prices outlook following Russia’s invasion of Ukraine.

In an update before second quarter results on July 28, Shell said its refining margins almost tripled over the period, boosted by recovering global demand from the pandemic, a lack of refining capacity and lower fuel exports from Russia.

Earnings from oil and refined products trading were expected to be strong in the quarter but lower than the first quarter of 2022, Shell said.

Shell’s indicative refining margin rose in the second quarter to $28.04 per barrel from $10.23 a barrel in the first quarter and $4.17 a year earlier.

Oil and gas prices remained elevated in the quarter, with benchmark Brent crude averaging about $114 a barrel.

“In the second quarter 2022, Shell has revised its mid and long-term oil and gas commodity prices reflecting the current macroeconomic environment as well as updated energy market demand and supply fundamentals,” it said.

Shell increased its assumed price for Brent to $80 a barrel in 2023, up from $60 in its 2021 annual report. For 2024 and 2025, the Brent price was increased to $70 a barrel compared with $60. The long-term price was $65, compared with $63.

The upgrade will result in post-tax impairment reversals of $3.5 to $4.5 billion.

Shell said it completed its $8.5 billion share buyback programme during the second quarter.

The company said in May it expects to increase returns to shareholders in the form of dividend and share buybacks in the second “in excess” of its current target of 30 per cent of cash from operations.

Shell’s oil and gas production was expected to be up to 2.93 million barrels of oil equivalent per day in the quarter, its lowest in at least seven years, as a result of high field maintenance.

Shell, the world’s largest trader of liquefied natural gas, said its quarterly LNG production was expected to be in a range of 7.4 to 8 million tonnes.

The figure reflects the removal of LNG volumes from the Sakhalin-2 plant in eastern Russia which Shell exited.

Shell’s larger rival Exxon Mobil last week signalled that skyrocketing margins from fuel and crude sales could generate a record quarterly profit.