fixed string index out of bounds