Remove an ugly use of isinstance().