Merge branch 'hotfix/4539'

Close #4539
Use the keys of the collectionData to filter against since they don't have to be consecutive
Merge branch 'hotfix/4516' into develop

Forward port #4516