multi-threading fix