fixed some bugs in refactoring