Fix a bug in the timeout handler.