Added better test for ES5 support so it works in IE8