Throughout the campaign, Donald Trump has issued dire warnings of foul play on Election Day. “I’m afraid the election’s going to be rigged,” he told supporters in Ohio. “I’m telling you, November 8, we’d better be careful,” he cautioned Fox News. “I hope the Republicans are watching closely, or it’s going to be taken away from us.” Trump’s remarks might seem like a cynical ploy to mobilize his base, or to set the stage for an aggrieved backlash should he lose to Hillary Clinton. In fact, however, the U.S. election system really is vulnerable—though not in the way Trump claims.

In July and August, Russian intelligence services hacked voter registration systems in Illinois and Arizona. But as menacing as foreign agents meddling with U.S. databases may seem, the biggest threat to the sanctity of the vote is the voting machines themselves. Like so much of America’s crumbling infrastructure, the systems we rely on to tabulate our votes fairly and accurately are in dire need of an overhaul. In thousands of precincts, the outcome of the election rides on equipment that’s outdated, prone to errors, and difficult or impossible to repair.

Ironically, what’s broken about America’s voting systems stems directly from the last major attempt to fix them. In 2000, the high-stakes recount in Florida threw an embarrassing spotlight on antiquated punch-card voting machines. To avoid more headlines about “hanging chads,” the federal government spent $3 billion to help states upgrade to high-tech, touch-screen machines. “People didn’t want that image of the guy with the magnifying glass and the chad,” says Pamela Smith, the president of Verified Voting, a nonprofit that monitors voting machines nationwide. “People were thinking: What’s the furthest thing away from a punch-card system?”

Almost from the start, however, the digital machines proved to be both vulnerable and unreliable. Many were built on 1990s-era software, making them easy targets for anyone who knew their way around computers. To demonstrate the potential for vote tampering, a group of computer scientists at Princeton hacked the machines in their lab, reprogramming one model to play Pac-Man. After voting machine manufacturers dismissed their findings, saying would-be hackers could never gain access to voting machines in the real world, one of the Princeton researchers took photographs of unguarded machines at local voting halls and posted them to his blog—a tradition he has maintained in every subsequent election. “When I go to vote, I realize that the people who most recently installed the software in that machine get to decide if it’s cheating or not,” says Andrew Appel, another of the Princeton researchers. “And the results may or may not have any relation to what the voters voted.”

Even worse, the new machines proved capable of screwing up elections all on their own, without any malicious tampering. In 2003, touch-screen machines in Virginia failed to record one vote out of every 100 for a school board candidate, reducing her overall tally by 2 percent in what proved to be a close race. The machines also crashed at a library polling place, a malfunction thought to have been caused by interference from a smartphone. Despite such obvious warning signs, the machines were eventually rolled out to jurisdictions across the state.

Many of the country’s 8,000 voting jurisdictions still rely on antiquated machines, and the problems have only escalated as the machines have grown older. According to a report from the Brennan Center for Justice at New York University, 43 states will use electronic voting machines this November that are at least 10 years old—and they exhibit all the issues you’d expect from decade-old computers. The glue inside some touch-screen models is so old, it has led to instances of vote flipping, where a voter presses the name of one candidate and the machine selects another. In Wisconsin this year, nearly 100 machines failed a test in the weeks before the primary, forcing taxpayers to pony up $100,000 to replace them before the general election.

To keep old machines running, some officials have taken to surfing eBay to order replacement parts, or to stock up on custom-made hardware or older-model computers that are compatible with Windows 2000 or Windows XP, the operating systems most of the voting machines use. Microsoft announced that it was cutting off updates for XP in April 2014, telling customers to either “upgrade” or “get a new PC”—an option unavailable to election officials dealing with strapped budgets. The aging systems, experts warn, are an invitation for trouble. “It’s like leaving your front door unlocked every day,” says Lawrence Norden, the deputy director of the Brennan Center. “Eventually something bad may happen.”

Perhaps most troubling is the fact that voters in 14 states—including battleground areas in Pennsylvania and Virginia—will cast their ballots this year on electronic machines that do not provide paper copies of the votes. That means there will be no way to audit the results should something go wrong. “It will be technically impossible,” says Gregory Miller, a cybersecurity expert who focuses on election technology. “We can’t do anything but rerun the tally the machines provide. This is not a hypothetical, Y2K problem—it’s a real problem that already exists.”

Some election officials around the country have upgraded their systems and mandated a paper trail—either by requiring paper ballots that can be run through an optical scanner, or by outfitting touch-screen machines with a printer that can provide a receipt. But fixing or replacing the machines has proven hard, in large part because the voting system has been privatized. Companies that control the market—including firms with strong ties to the Republican Party, like Diebold and Election Systems & Software—have fought to block reforms and silence critics who have exposed flaws in their machines. To truly fix America’s broken voting system, we need to make our technology as democratic as our political system: replacing privatized voting equipment with open-source software that is free, transparent, and easy to update.

The Open Source Election Technology Institute, a nonprofit research center founded by Miller, is currently developing a voting system that anyone with knowledge of code can understand—unlike the “black box” of commercial machines, which leave local election officials in the dark and require a maintenance person from the manufacturer. What’s more, the open-source program can run on consumer tablets, laptops, and scanners—far cheaper than one-function voting machines. And as with any other piece of software, glitches or bugs can be fixed with new code that’s been rigorously vetted to prevent shenanigans. “The industry today is stuck,” Miller says. “In the time we’ve changed our cell phones five times, the same equipment is still running our elections.”

But moving to open-source software won’t do anything to help prevent trouble in this year’s election. In August, after Russian hackers planted malware on Arizona’s voter registration system and stole personal data for 200,000 voters in Illinois, the FBI put the country’s entire voting system on alert for cyber invasions. Government officials insist that the hackers didn’t succeed in changing or deleting voter files in either Arizona or Illinois. But Miller, who was asked to brief the Department of Homeland Security on the state of America’s voting infrastructure following the hacks, isn’t convinced. “We don’t know what we don’t know,” he says. “That’s the problem here.”

But even with his insider knowledge about the cyber-attacks, Miller fears faulty machines more than foreign hackers. A buggy voting machine, for example, could cause long lines at the polls in a crucial swing state, or a faulty touch-screen could switch votes from Trump to Clinton. And even if such glitches don’t affect the outcome of the election, a snafu or two in traditional GOP strongholds will most definitely fuel the conspiracy theories. Indeed, Trump’s comments on the campaign trail have already primed voters to believe the election will be a sham: According to the Pew Research Center, just 11 percent of Trump supporters believe their votes this year will be tallied fairly. It’s a recipe for a repeat of the Florida fiasco in 2000—except that unlike Al Gore, Trump is hardly one to bow out gracefully.