fix bug in refactoring