fix bugs,add test file