fix char index