Fixing indexOf compatibility with IE8