Backport fix for QA-6833 from master:f4ffd0045e16c4c1681a64f93d4b91ce3574957d