added timeout detection