Fixed bug about encoding