solving the problem with race condition