Merge pull request #3528 from BrzVlad/fix-sgen-check-before-collections