How many U.S. dams are at risk of a crisis like the one currently unfolding in California, as officials work to stave off disaster at the compromised Oroville Dam? The short answer is, we don’t really know—but probably quite a few.

Until this month, Oroville’s emergency spillway had never been used in its nearly 50-year history. After weeks of rain and a breach in the dam’s main spillway, officials turned to the auxiliary one to help prevent an overflow from the dam’s lake. The resulting hillside erosion threatened serious flooding and prompted the evacuation of some 188,000 people.

Environmental groups predicted the crisis in 2005 when they called for the emergency spillway to be reinforced with concrete, but state officials dismissed that request as unnecessary. Though cost wasn’t publicly cited as a factor, critics can reasonably contend it was a consideration.

If so, “it’s certainly not the only dam that put off upgrades because of upfront cost,” says Jenny Rowland, public lands research and advocacy manager for the policy think tank Center for American Progress.

Oroville is just one of more than 90,000 dams across the country, many of which are aging and underfunded, prompting the American Society of Civil Engineers (ASCE) to give the nation’s dams a “D” grade in its last infrastructure report. In Minnesota, for example, repairs to the 107-year-old Byllesby Dam have been postponed for lack of funding.

Byllesby is one of more than 15,000 dams federally classified as “high hazard potential,” which says nothing about a dam’s actual condition, but indicates that a failure would result in “probable loss of life.” Missouri, North Carolina, and Texas have the highest concentrations of those dams, according to the infrastructure report—and there are at least a couple dozen in every state.

View Images Heavy flows from the Oroville Dam spillway continue to push debris into the Feather River. Photograph by Florence Low, California Department of Water Resources

The number of high hazard potential dams is increasing because many of them were built in rural areas where the risks to nearby residents didn’t need to be considered at the time. But as the population increases, many dams are subject to what’s known as “hazard creep.”

“Rural and urban population sprawl has created new development downstream of many existing dams,” Rowland writes in a report on U.S. dams released last fall, “putting more people at risk should a dam fail.”

The U.S. has a National Inventory of Dams, but that doesn’t track thousands of smaller dams that could still cause damage, Rowland says, and it doesn’t tell you a dam’s condition. About 64 percent of them are privately owned, and another 20 percent are operated at the local or state level, like Oroville.

“There’s a lot of different ownership going on and not really a comprehensive reporting database,” Rowland says, adding that there is no systematic identification of which dams need upgrades or should be removed altogether. The latter are increasingly targeted by activists who say such “deadbeat dams” that no longer provide useful functions should be taken down, to reduce risk and restore habitat for wildlife.

View Images Water flows through a gaping hole in Idaho's Teton Dam, which failed in 1976, killing 11 people. Photograph from Bettman, Corbis

Still, states have stepped up their inspection efforts in recent years, according to the Association of State Dam Safety Officials (ASDSO). The average dam is more than 50 years old, and more than 4,000 of them have been deemed “deficient,” or needing repairs.

“At best, putting off repairs will likely cost the dam owner five to ten times as much, fifteen years down the road,” the organization says in a fact sheet. “At worst, it kills people.”

Eleven people died when Idaho’s Teton Dam failed in 1976. That and other catastrophic, deadly failures in the 1970s led to the creation of the National Dam Safety Program, which drove an increase in inspections and emergency plans.

Teton was a “milestone event” that led to a rethinking of dam safety, says John France, an expert with the ACSE. Now every state except Alabama has a safety program to handle inspections, training, and other precautions. France says the industry also has done a better job at factoring “everyday issues” such as erosion into safety risk, along with rarer events such as floods and earthquakes.

“Overall, dam safety in the country has improved in the last 30 years,” France says, “but we’ve got a lot more work to do.”

France notes that designers of older dams didn’t know as much as we do now about dams and how they perform when stressed, which can lead to design deficiencies. This, along with hazard creep and general wear and tear, means the number of dams susceptible to failure has more than quadrupled in the last 15 years, according to state safety officials.

But modernizing dams costs money, and funding hasn’t been sufficient. Some dams have seen critical repairs in recent years: Kentucky’s Wolf Creek and California’s Folsom are recent examples. Still, “for every high-hazard-potential dam repaired,” the ASDSO says, “nearly two more dams have been declared deficient.”

Rowland at the Center for American Progress argues for a federal fund to help subsidize upgrades and repairs at sites like Oroville—the kind of projects that wouldn’t necessarily attract the investors on which President Donald Trump’s infrastructure plan relies. Certainly, addressing all of the potential failure points in the current U.S. dam system will require a flood of cash: The ASDSO puts the figure at “well over $60 billion.”