added checkmate detection