Fixed some memory leaks
Fixed some memory leaks