COMP: partially fix #9, and a leak