It's not the ballots that are contested. The voting machines automatically reject any ballot incorrectly filled out. 

ex. This was a preferential ballot, so voters ranked the candidates. If a voter chose 2 candidates for 1st preference, the ballot was immediately rejected when it was scanned by the electronic vote recorder as the vote was cast. 

There was a discrepancy between the number of votes automatically counted by the machines, and the number of voters manually recorded by the volunteers at the polling stations. 

The manually recorded number of voters was lower than the number of votes automatically counted by the machines when each vote was cast. 

This was because the volunteers sometimes forgot to check off the person's name as "voted" when they presented themselves with their ballots and ID at the polling stations, and then proceeded to cast their ballots into the electronic vote-tallying machines.

p.s. The voting machines kept copies of each ballot they scanned.