Add some docs and fix unit test issue