It starts with a serious ballot dispute in November, something like the contested results in Florida during the 2000 election—the odds of which aren’t trivial. Setting aside the very real prospect of a Hillary Clinton-Donald Trump nail-biter, the risk of a recount and related litigation is higher than it was in the past, thanks to a greater number of absentee and provisional ballots, which often get counted after Election Day.

In this situation, the Supreme Court could step in to resolve the dispute. But the odds of that happening have probably decreased due to the vociferous criticism of the Bush v. Gore decision. Not to mention that in the wake of Justice Antonin Scalia’s death, there could still be only eight sitting justices in November; that also makes it more likely the court will stay out of the matter this time.

Under the Constitution’s Twelfth Amendment, the fight would then fall to Congress—which entirely lacks adequate procedures to decide a presidential election. In fact, the process for settling election disputes is so messy and uncertain that even experts disagree about how it’s supposed to work.

What Congress does have is that tangled 809-word statute passed in 1887 as part of the Electoral Count Act. The statute is intended to resolve disputes when a single state submits two different Electoral College vote counts—for instance, if there’s a contested county and its votes are enough to swing the state—and the Senate and House then split over which of the two counts to accept. With language so convoluted it was deemed “unintelligible” by the nation’s leading political scientist at the time of enactment, the law leaves debatable exactly what’s supposed to happen in this situation. Passed as a stopgap measure, it has never been replaced with a clearer or more executable plan.

A key provision of the act says that if the House and Senate are split, the governor of the state in dispute becomes the tiebreaker. This provision, still with us, presents two problems. First is the possibility of a serious conflict of interest for the governor. For instance, in 2000, Florida Governor Jeb Bush might have been tasked with deciding the election that his brother George went on to win. (That eyebrow-raising scenario did not come to pass because the Supreme Court decided Bush v. Gore before the Electoral College meeting in Florida that year, so Florida sent only one set of Electoral College votes to Congress after Al Gore conceded defeat.) This year, if Ohio turns out to be the pivotal state, as is certainly plausible, Governor Kasich might be in a position to pick the winner single-handedly. This would be strange enough if he’s just a former contender in the race, and stranger still if he is the GOP’s presidential or vice-presidential candidate.

The second problem is that the law is so hopelessly incomprehensible, it’s ambiguous as to whether the governor-as-tiebreaker scenario applies in all cases in which a single state sends two Electoral College submissions to Congress, or only in a much narrower subset of these cases. The latter view holds that, except for in some relatively rare situations, Congress is obligated to treat the disputed state’s Electoral College proceedings as null-and-void regardless of what the governor certifies. In the Ohio hypothetical, the debate would be whether to count Ohio’s votes as certified by Kasich, or instead to toss out the votes entirely as uncountable. Proponents of each interpretation of the law could cite arcane scholarly articles in support of their dueling positions, but the debate would hardly be academic—each view would produce a different presidential winner.

How did our system become so hopeless? The Electoral Count Act grew out of the disputed presidential election of 1876, when Congress received multiple, conflicting submissions of Electoral College votes from several states, including Florida. The two chambers were split: The Senate, in Republican hands, supported Rutherford B. Hayes, the Republican candidate. The House, with Democrats in the majority, backed Samuel Tilden, their party’s nominee. The Constitution—then as now—provided no tie-breaking institution to resolve partisan deadlock in such a situation.

In January 1877, Congress enacted a compromise statute creating an Electoral Commission to serve as the tiebreaker. (Inauguration Day was on March 4 back then, so there was still time to pick the new president.) The commission—five senators, five representatives and five Supreme Court justices—was a good idea in principle. But it was poorly designed; the ideological breakdown—seven Democrats, seven Republicans and one neutral member—was a recipe for two partisan blocs to emerge.

As it happened, the designated neutral in 1877, Supreme Court Justice David Davis, declined to serve, and the compromise statute required the substitute to come from the Supreme Court. There were only four available justices by that point, and the least objectionable was Joseph Bradley, a clear Republican. The balance was tipped: For each disputed state sent the commission’s way—Florida, Louisiana, Oregon and South Carolina—the body consistently split 8-7 along party lines in favor of Hayes. As Congress took Electoral College submissions in alphabetical order, the Democrats increasingly dismissed the commission’s deliberations as a rigged farce.

To make matters worse, by the time Congress reached Vermont on February 28, just four days until the scheduled Inauguration, there was a surprise development. Republicans had predicted that Vermont would count for Hayes, but hardline Democrats in the House suddenly concocted an argument that Vermont should be disputed—and thus needed the attention of the very commission their party now reviled. What the Democrats wanted was to recreate delay and deadlock over the commission’s role so that the process would still be unfinished by the time March 4 arrived. At that point, they could invoke the constitutional authority of the House, conveniently under Democratic control, to pick the president when no candidate receives an Electoral College majority (as had happened in 1800 and 1824).

When the House convened on March 1, there was a very real prospect of two separate inauguration ceremonies three days later, one for Hayes, led by the Senate, and the other for Tilden, led by the House. Which candidate would rightly take power and occupy the White House? Which one would the military obey?

The crisis was averted on March 1, thanks to the speaker of the House, Samuel Randall, putting country before party. A Tilden loyalist, Randall nonetheless refused to let his fellow Democrats vote whether to continue their obstructionist maneuvers and insisted that Vermont be treated as the Republicans demanded. The hardline Democrats were furious. In what news accounts and historians have described as the House’s “stormiest” session—with pistols ready and ladies cleared of the galleries—Randall had to ask the sergeant-at-arms to restrain members of his own party. Yet he prevailed: Vermont counted for Hayes, and the election process was completed in the early hours of March 2.

It wasn’t until a decade later that Congress finally moved to prevent such a procedural crisis. The election of 1884 had been another close call—the winner, Grover Cleveland, wasn’t known for two weeks due to a tight race in his home state of New York—so in preparation for the 1888 election, Congress passed the Electoral Count Act of 1887. This law, too, was flawed, however—even its authors considered it a stopgap until they could come up with something better. The law’s main proponent, Senator George Edmunds, a Republican from Vermont, had wanted to create an improved version of the Electoral Commission. But the Democrats, still disgusted by the 8-7 commission a decade earlier, refused to go along. They would accept only the rule that currently stands: the provision allowing a single governor to break the tie.

One hundred-thirty years later, that stopgap law still stands—which means that in 2016 we could find ourselves in a crisis not unlike in the Hayes-Tilden election. Electoral College votes might be contested in a crucial state, and the two chambers might be deadlocked. Or, even if the Supreme Court intervened and came to a non-tie decision, the candidate who loses at the court might refuse to concede, and the dispute would again fall to Congress, which might well split over how to count the state. We all would be at the mercy of the 1887 Electoral Count Act again—and then what happens? How would the governor of the state in question decide? Would Congress affirm that governor’s verdict, or might hardliners in either party put up a fight? If he were challenged by hardliners in his own party, would Speaker Paul Ryan override their demands? Would we really want to put Ryan—and the nation—to this test?

It’s time for Congress to fix these flaws. The best solution might be to go back to the Electoral Commission model—with some improvements. That could mean, for instance, a simple three-member arbitration panel, perhaps federal judges—one Democrat, one Republican and a neutral member chosen by the other two, with an adequate substitution provision, if necessary. The panel should be given unambiguous authority to resolve any disagreement between the Senate and House over the counting of Electoral College votes. In reality, any definitive tiebreaker would be better than the current governor-as-tiebreaker provision, given the uncertainty over when it applies.

The odds of the Kasich-as-decider scenario might be low, but the point is that it could happen. Prudence dictates taking no chances and using the remaining months before November to adopt an actually workable Electoral Count Act. This year’s presidential election already has been unpredictable in so many ways, and we still have a long way to go. Who’s to say 2016 won’t be another 1876?