fix typos. simplify tail