Fix possible race when building in massive parallel.