Made fail_bounds_check more careful with strings.

Fixes #11976.