fix bugs and update doc