wait for server before registering function

Change-Id: If2fd7c907c9e3bc1a2e779af9ae834d5a0d3bcc7