fix incorrect merging related to threading