Add more defensive code to detect invalid indices in text data