Adjust lastIndexOf to match es6 spec

Fixes #1705