encode error fixed