bad encode fixed