Fix defensive copies issues