fixed memleak

fixing memleak