Leaks with threads solved [there are some leaks with try and threads]