fix bug with char count