Fix incorrect results for referrals and more

Memories getting polluted by shared