Major fixes for IE 9 support