add type conversion function