Contributed by Vishwajeet Dusane. (cherry picked from commit bd5ab5912564d2d687651b01f552b8e4ca8c145a)