fix string indexing usage