stalemate detection bug fix