make type_cast_value a class level method