fix a lot of memory leaks