Fix conditional type comparation using isinstance()