fix typos and trivial bugs