Contributed by Vishwajeet Dusane. (cherry picked from commit 95a96b13e2a54e01ea6c6933045d912998477da3)