added timeout control