Restore mode change after refactoring