Finally fixed this annoying memory leak