delay: fix possible race condition, closes #8