Further fixes to referral tracking