Applied @lohmander's fix for IE8 memory bug.