Fix refactoring bug