added timeout handling