little fix and output to file duplicate mode