Add guard for gettting text from an element.