Partially reverts #3641
Merge pull request #4527 from yurydelendik/revert3641

Partially reverts #3641