Contributed by Da Zhou <da.zhou@microsoft.com> (cherry picked from commit 1a3a4960d91aa594283e447963fb2e407d4c6af5)