added timeout check