bug fixing in threat_safe_queue