Resource leaks fixed.