Fix IE8 error on window resizing