bugfix in foreach: removed logger if length=0