refactoring error fixin