fix a race around Events waited on with a timeout