fixing refactoring bug