added code to handle IE9 or earlier