fixing memory leaks
fixing memory leaks