Fix issue #1239
object of type 'filter' has no len()