added timeout and some error messages