Fixed refactor bug