cleaned up some memory leaks