Solved race condition