Fixed a couple bugs in the way the end of the match was being detected.