Improve the build stability against race conditions