rewrite client, server