Doctors don’t know when their painkiller patients overdose, and 91% of overdose survivors keep getting prescriptions for those addictive drugs as a result, according to a medical records survey published on Monday.

Doctors in the U.S. write more than 200 million prescriptions for opioid drugs such as oxycodone and hydrocodone every year, amid a painkiller addiction epidemic. Overdoses are one result, killing around 17,000 people with prescriptions for the drugs yearly, out of some 300,000 total overdoses nationwide.

The new analysis of 2,800 prescription opioid overdose survivors found that most of those patients keep getting prescribed opioid painkillers, despite an overdose, and usually by the same doctor. Around two-thirds resumed their prescription within a month of their overdose, and some 9% to 17% of those patients went on to have another overdose in the next two years.

“This kind of risk is way too great to continue prescribing,” study lead author Marc Larochelle of Boston Medical Center told BuzzFeed News. “There has to be a way for an alarm bell to go off when an overdose happens for doctors.”

In a commentary accompanying the study, addiction treatment expert Jessica Gregg of Central City Concern, a nonprofit social service agency in Portland, Oregon, said the findings were “astonishing” and called for changes in reporting and treatment of overdose patients. Otherwise, she said, “patients will continue to suffer — and even die — and physicians will continue to believe they are powerless to stop it.”

The researchers sampled patients from all 50 states aged 18 to 65 who belonged to major health plans, and excluded cancer patients and illicit drug users. The study also didn’t include veterans or people on Medicaid, who are at even higher risk for opioid addiction, instead only counting typical chronic pain patients.

“These are the people who are supposed to be getting the best health care and we still aren’t treating them like we should,” Larochelle said.

“I’m saddened but not surprised by the results,” Gail D’Onofrio, chair of emergency medicine at Yale University, told BuzzFeed News.

Most alarming, she said, was the report that more than half of the patients in the study were also receiving benzodiazepine drugs such as Valium, commonly given for anxiety, which she said can lead to fatal overdoses in combination with opioids. “You have to worry that different doctors are prescribing the different drugs and there is a misunderstanding of the consequences.”

The study underlined the need for careful weaning of people off opioids after an overdose, both D’Onofrio and Larochelle said. Even among patients who didn’t continue their prescription, 8% would have another overdose within two years from illicit use, the researchers said. “You can’t just cut addicted people off from the drug and not treat them,” Larochelle said.

Insurance companies could alert doctors with medical records to overdoses, catching cases in emergency rooms they would otherwise miss, the study suggested.

“We need better training for prescribing these drugs,” Larochelle said. “Treating pain is really difficult. It gets at the heart of why people become doctors, to relieve suffering and to heal people. So it is hard for doctors not to prescribe something when people come to them in pain.”