Fixed bugs for naming output file convention