more threading fixes