fix global leak [closes #7]