Fixed many server/client bugs