incorrect use of flatten with an array of Sets