fixed IE8 bug in javascript