Fixed bug in searching for referral