speed up isType by 35% from original isType function