Some memory leaks fixed.