fix cancel button and one flag at a time