Fix refactor bug