Tesla is recalling more than 2 million vehicles across its model lineup to fix a defective system that’s supposed to ensure drivers are paying attention when they use Autopilot.

Since 2016, the National Highway Traffic Safety Administration has investigated 35 crashes they suspect involved Tesla Autopilot. At least 17 people were killed in those crashes.

Wednesday’s recall covers more than 2 million Tesla vehicles sold over the last 11 years — nearly all Tesla vehicles on U.S. roads.

The recall includes Tesla models Y, S, 3 and X made between Oct. 5, 2012, and Dec. 7, 2023.

Autopilot can steer, accelerate and brake automatically in its lane, but is a driver-assist system and cannot drive itself despite its name. Independent tests have found that the monitoring system is easy to fool, so much that drivers have been caught while driving drunk or even sitting in the back seat.

Auto safety advocates, including those from Consumer Reports, have been calling for stronger regulation of the driver monitoring system, which mainly detects whether a driver’s hands are on the steering wheel.

According to documents posted Wednesday by U.S. safety regulators, Tesla has agreed to a software upgrade that will add driver alerts to make drivers pay more attention.

The recall comes after a two-year investigation by U.S. auto safety regulators into a series of crashes that happened while the Autopilot partially automated driving system was in use. Some were deadly.

The National Highway Traffic Safety Administration says its investigation found Autopilot’s method of ensuring that drivers are paying attention can be inadequate and “can lead to foreseeable misuse of the system.”

The latest recall covers nearly all of the vehicles Tesla sold in the U.S. since it activated Autopilot late in 2015.

The software update includes additional controls and alerts “to further encourage the driver to adhere to their continuous driving responsibility,” the documents said.

The software update was sent to certain affected vehicles on Tuesday, with the rest getting it at a later date, the documents said.

In its defect report filed with the safety agency, Tesla said Autopilot’s controls “may not be sufficient to prevent driver misuse.”

A message was left early Wednesday seeking further comment from the Austin, Texas, company.