refactor error fixed