fixed StringIndexOutOfBoundsException