fix refactor bug, working now