adding timeout to prevent hanging