add test class and modified some function