fix typo in code that expands letfn; add tests