Weird things happen with nested list comprehension