Threading fixes.