now properly stops threads