added timeout to connect