better timeout handling