Behavioral flexibility as a mechanism for coping with climate change