Multi-threading fixes.