WIP on memory leak fix