update flatten and fold examples