Fix for Internet Explorer 10 failing to load

Lots of little fixes as IE creeps towards standards
compliance.