Retain entities and fixes for html5lib