Fixed the issue of duplicate task entries due to multi-threading.