fixed refactor bug