Improved handling of Range, to work with polymorphic types.