fix typos, remove redundant code