Fix deadlock situation in Cancel