fix callback called twice, fix unit test.