fix bugs of settings & refactoring