add test on bug and refactoring