Trying to fix ATR-22236.
See merge request !22161 (merged)
(cherry picked from commit 83c1cc15)
/cc @rbielski @mnowak @gemmeren