Fix ivar memory management