threading fixes