You know, as probably causes go, that really isn't that bad. Certainly, people have been stopped for less, and kept just as long or longer. If they made a mistake, it was that they didn't have an efficient procedure for figuring out whether the chemicals detected by the machine were actually explosives or not. Incompetence is bad, certainly, but not as bad as corruption.
They also broke into his apartment while doing that, and detained him for the better part of a day with no real probable cause other than "this machine said something".