refactoring and fix bug while enable after disable