Taking certain – but not all – antibiotics in early pregnancy has been linked to a higher miscarriage risk, according to a new study.

The research, published in the Canadian Medical Association Journal, finds that common antibiotics, including macrolides (aside from erythromycin), quinolones, tetracyclines, sulfonamides and metronidazole, increased the risk for miscarriage, CNN reports.

The good news? Penicillin, one of the most commonly used antibiotics did not increase miscarriage risk, nor did others like nitrofurantoin (a typical urinary tract infection medication) and erythromycin (a medication for everything from skin infections to chlamydia).

Researchers examined data from the Quebec Pregnancy Cohort, focusing on 1998 to 2009. They analyzed pregnancy outcomes in relation to the antibiotics given to women in early pregnancy. They discovered 8,702 “spontaneous abortions” (aka miscarriages prior to the 20th gestation week), compared to 87,020 pregnancies without a miscarriage. More than 16 percent of the women who miscarried had taken antibiotics in early pregnancy.

“One major concern is that many of these antibiotics – tetracycline, (doxycycline, a type of tetracycline) and the quinolones – are not used in known pregnancies,” Dr. R. Phillips Heine, of the American College of Obstetricians and Gynecologists’ Committee on Obstetric Practice, told CNN. “This implies that the pregnancies were early and were missed by the prescribing clinician. Many of the antibiotics that were associated with abortion are not used in obstetrics,” he noted.

When determining the heightened risk for miscarriage, researchers accounted for age and other health infections the women may have had. Study author Dr. Anick Bérard told CNN that just having the infections for which they got treatment might lead to pregnancy loss, which could account for the increased miscarriage risk her team observed. Leaving the infections untreated is not an option, she added.

“The take-home message is that infections need to be treated during pregnancy,” Bérard, of the Faculty of Pharmacy at the Université de Montréal, told CNN.

The study is not without limitations, including that only women insured by the province’s Prescription Drug insurance program were included; the findings may not apply to those insured by private companies.

Still: “If there is an association between antibiotic exposure and the risk of nonclinically detected spontaneous abortion, our findings are conservative and thus underestimate the true risk,” according to the study.