Fix type comparison to isinstance check