Fix crash on cancel