modified the client encode