Fixed a couple of small memory leaks