Fix trimming output file