Reuters

THE polls go up, the polls go down and there are still more than three weeks to go: time for any amount of sleaze or terror to influence the voters. But it is quite possible that America's mid-term elections on November 7th will produce a close result, not just in the House of Representatives, where it has long been predicted, but in the Senate too. At which point things could get fraught.

The problem is voting machines. Not the ones with hole-punches and their chads, hanging, swinging and dimpled. Since the debacle of 2000 in Florida federal money to the tune of several billion dollars has been lavished on replacing them. Unfortunately, many have been replaced with new ones that may be even worse. In a close election the prospect of just a handful of the 435 House seats or one or two of the 33 Senate seats at stake being furiously challenged in court is all too plausible. Like the presidency in 2000, the colour of Congress could have to be decided by lawyers.

How could this have happened? Mainly because lots of states and counties went for touch-screen devices, very like ATMs, instead of a much better alternative, optical scanners that count votes marked by hand on paper ballots, rather like lottery forms or multiple-choice exam papers. The good thing about scanners is that the original ballot is by definition available for re-counting. With touch-screens, it isn't. Fortunately, more than half of America's 3,000-odd counties have opted for scanners. But about a third have chosen the touch-screens.

A thermal printer to produce a record is available as an added extra on some touch-screen machines. But when these were tried out, as they have been across the country in primary elections in the past few months, the results were not encouraging. If the paper is put in wrongly, the printer does not print at all. Even when it was the right way round, there were many cases of the paper jamming, tearing or producing unreadable results. The fact that most election officials are unpaid volunteers, very often elderly and with little or no training, also caused difficulties. At any rate, with a touch-screen system the paper-trail is produced by the machine, and so is only as good as the machine. And the machines, it also turns out, may be vulnerable to tampering.

In September three scientists at Princeton University got hold of the most popular touch-screen model and took it and its software to bits. They found serious flaws allowing a competent hacker to infect the machine with a program to transfer votes from one candidate to another. Such a change could be undetectable without a recount (assuming one were possible), and the program could be introduced into the machine far in advance by anyone having access to the machine's memory-card reader for as little as a minute. The readers are protected by a lock, but the lock is a standard one, and keys can be bought on the internet: besides, the keys circulate among election officials. And the researchers found that their program could be spread from machine to machine via the memory-cards. Voting-machine companies make things worse by keeping their software secret: were it published, security experts would be able to assess it and recommend fixes.

Pray for a clear result—and then buy some decent kit

Many people will see this as a conspiracy too far, and perhaps it is. But another problem is that the machines used at polling stations have a tendency to break down. Avi Rubin, a computer science professor at Johns Hopkins University who is also an election volunteer, has blogged scarily about his experiences at the primaries in Maryland. (In his case, most of the problems occurred not with the voting machines but with other terminals, designed to ensure that people are entitled to vote and have not voted twice.) Elsewhere, there have been horror stories of votes failing to register or upload, of memory-cards going missing, and of machines crashing and losing stored votes. Only a few such cases can damage confidence badly: and crashes, at the least, cause huge delays.

The solutions are not hard to find: a wholesale switch to paper ballots and optical scanners; more training for election officials; and open access to machine software. But it is too late for any of that this time—and that is a scandal.