Improve connection timeout handling