fix potential out-of-bounds string index error