IDEA-119521 improvement
(cherry picked from commit 2d6afbe)