fix checkmate and stalemate conditions