some bugs, fix typos