update tests
some fix and refactor