fixing memory leaks??