Fixing global leaks