Some gcm and sample server improvements