client: fix bug when encoding error occured.