fixed refactoring bug and wrong this binding