Fixed character translation and index error