compilation fixed

used 'flatMap' on 'iterator'