Fix various bugs for IE9