fix cancel logic