improve timeout check