Fixing collection_of replacement and dirty tracking