Fix url generation when userId is null.