Fix string index out of boudns