add unit test for idm, fix UT issues