fix testing thread cleanup