Change to use isinstance