Improved the switching of types, particularly for numbers.