Fix the waiting system

Not having the lock doesn't necessarily means that the waiting time
should be reset.