to_index_string() can return NULL.

Also, since to_index_string() has the length of the return value, why not let it set it?