Collections created in library file versioning need to be set as coming from the library, otherwise they get freed on undo.