custom keys: changed folding example with cast_to