refactoring bug