register until it succeeds