fixed some memory-leaks