resolving memory leaks (1 missing)