add unit test and fix lint issue