fix refactoring bugs
Merge branch 'dev'