fix refactoring bugs
merge