Improve type mapping #535