Resilience and adaptation in smallholder agriculture to climate change