Fix isinstance check