adding a sleep to beat race condition