Contributed by Sharad Sonker. (cherry picked from commit 050f5287b79324b7f6231b879c0bfc608203b980) (cherry picked from commit 07c7df4b261f23e567d58936b78aee4ab73cb5fc)