fixed refactoring bug