fixed more threading issues