bug fix, and doc imporove