better fix for IDEA-111684
(cherry picked from commit bb558e8)