fixing memory leaks 2