Fixes for memory leaks (Christian)