Fix HTML5 compliance issues

Closes #322, i just took @bertware's patch and turned it into a PR.