remove some memory leaks