fix bug of encording