Transferred some changes in HarvestResource from cherry-picked commit