fixed totally broken voting system

so due to lack of proper debugging a whole bunch of bugs in the voting
system snuck up on me, these changes bring everything back to a
completely working state