make unit test pass with refactorin
fix test and add some missing ones