Fix refactoring errors