race condition solved