better handling of long HTML strings, closes #39