fix a encode bug