Fixing race condition with b793e656292f27b1c4c67d22e08cb4180703b939