Fixed up memory leaks