fix text and image attributes

Now return null if empty.