add check for cancel