fixed outputing files