add test and bug fix
some fix