Regulators have approved a fix for nearly 40,000 Volkswagen group vehicles with 3.0L TDI engines in the U.S.

The approval covers 2013-2016 Porsche Cayenne and Volkswagen Touareg models, as well as 2013-2015 Audi Q7 crossovers that were involved in VW’s diesel emissions scandal.

Getting an approved fix is big news for Volkswagen. The company had agreed to buy back nearly 80,000 of the crossovers if they couldn’t be repaired. That would have seen VW pay up to $4.04 billion to buy them back.

The automaker will still have to pay between $8,500 and $17,000 each to owners who get the fix, but that represents significant savings over having to buy back the vehicles and possibly not being able to resell them.

SEE ALSO: What Volkswagen’s ‘Dieselgate’ Is, and Why it Matters

Some of the affected SUVs will need a hardware and software fixes, but the newest models only need software changes.

This doesn’t cover all of Volkswagen’s 3.0L diesel engines though. There are still around 20,000 older vehicles that need a fix. Volkswagen said that it is working with regulators to get fixes for the rest of the dieselgate affected vehicles.

The total diesel emissions scandal bill for Volkswagen in the U.S is now around $30 billion.

Volkswagen has already approved fixes for more than 400,000 affected TDI models in the U.S., but most of those were 2.0L TDI models.

In an effort to repair the company’s image, Volkswagen is charging full-on into electrifying its lineup. The company is currently planning to introduce more than 20 new electrified models by 2020.