Replace deprecated `index` function

http://pubs.opengroup.org/onlinepubs/009695399/functions/index.html