Fixing refactoring's bug