Improve type conversion