Fix crash on mode removal.