fix iterations for takeWhile