Fixes #3151 length() used on @referrals (did you mean "scalar(@referrals)"?)