fix multithreaded compilation race condition