fix bugs,and add a new test