fixing some global leaks