minor threading fixes