wip: fixing memory leaks