fix typos and bugs