Fix bugs and update document