[[ Bug 12846 ]] Copy bugfix 12463 to refactored code
Merge pull request #920 from runrevali/bugfix-12846

[[ Bug 12846 ]] Copy bugfix 12463 to refactored code