fix the encode issue