cast values to the proper type