fixed memory leaks
fixed some more memory leaks