fixed bug where threads weren't released