Fix miscellaneous bugs in IE6-8