Avoid function usage in loops
Merge pull request #5830 branch 'hotfix/5830'
Merge pull request #5833
Merge pull request #5833 in develop