prevent encode exception