Fixed a couple memory leaks