Fix a bug in timedwait.