code fix and test for callback mode
more fix, more doc