Repaired race condition