Some fixes and improvements to HTML5 export