Fixed a bunch of leaks