refactor to fix refleaks
2 files changed