Fix bug when detecting a winner