added missing files + correct memleak