Fixed the stalemate bug