Fixed server and client code - clean fix