further fix for the memory leak