Defensive programming for timeouts