update X and O