check mate logic fixed