Fix truncateWithEntities() off by 5 and other oddities