Fixed a few memleaks