Race condition solved