Fixed a massive memory leak.