This change should fix the memory leak issues.