I doubt Brazil is ever going back to paper voting. With that said, human vote counting is exploitable/error-prone, too, and electronic vote counting instead of electronic voting seems like it'd have the same issues the voting machine has.
The solution is clear to me, make it open-source, give bounties for issue-fixing. If the current software is crap hire RSA and/or some nice software shop to refactor and audit it, then open-source it.