merged cherry-picked 6d138879c65e104e77bff46b6803ffbf2593de06 from master