use isinstance not type