more reliable way of obtaining text content