replace reduce with collect