fix typos and minor bugs