Fixed a bug in victory-checking