memleak fix part 1