Checking index bounds in string-ref