fix a couple of memory leaks