code refactoring, and bugfix(hook miss)