Fix bug with char encoding