Fix generated html validity

Resubmitted as per #24