added CastErrorMode. Used default value of type for cast empty list to single value.