Fixed bug for characters with more than two bytes