fixed refactor errors