fix deprecated FlattenException