Fixed text file output issue