Fix a race condition in the clock, tasks could get lost.