Fixed remaining memory leaks.