fix ressource leaks