Memory Leak bugfix