BugFix (HTMLTPL): Catch errors with non-existing references.
TODO: additional items (ideas from converting my paper with Radek).