Fixes misuse of indexOf

Javascript is stupid