Better checking and saving of checkout state