function for converting data types