Error in refactoring