SOS-2288 Bringing back and fixing code removed by "LPS-41825 Fix backport" commit