Added replace methods both to client and server.