add unit_test and modify code
update