corrected bug that always displayed a space at the end of a flatten list