Fixed the encode issue