fix string indexing