Fix list comprehension bug

List comprehension during isinstance check caused assertion error.