refactor bug