Fix mode-related crash.