maybe this gets rid of the race condition?