Better handling for wildcard types.

Thanks to @deadalnix for the idea.