Fix JS error

Buggy JS fixed for IE.