Sync server->client first. Fix bug on env var