remove bugs and fix typos